Git Product home page Git Product logo

Comments (12)

skelterjohn avatar skelterjohn commented on July 28, 2024 1

I'll see about getting an example in there.

In the meantime, this cloudbuild.yaml will do a docker build that uses, as its cache, the previous image built by the same config file.

steps:
- name: 'gcr.io/cloud-builders/docker'
  args: ['pull', 'gcr.io/$PROJECT_ID/my-image']
- name: 'gcr.io/cloud-builders/docker'
  args: ['build', '--cache-from', 'gcr.io/$PROJECT_ID/my-image', '-t', 'gcr.io/$PROJECT_ID/my-image', '.']
images: ['gcr.io/$PROJECT_ID/my-image']

from cloud-builders.

Philmod avatar Philmod commented on July 28, 2024

Hi Daniel,

We are looking into this upgrade, but have no specific date yet.

from cloud-builders.

bendory avatar bendory commented on July 28, 2024

We have now upgraded to Docker 17.05, so --cache-from is available. Let us know how it goes!

from cloud-builders.

jakobholmelund avatar jakobholmelund commented on July 28, 2024

i can't seem to get --cache-from to work

from cloud-builders.

skelterjohn avatar skelterjohn commented on July 28, 2024

Did you docker pull the image into the job first? --cache-from won't work unless the image is already available on the host. Seems like an odd design choice on their part, but there you go.

from cloud-builders.

ties avatar ties commented on July 28, 2024

This works for me, but a minimal cloudbuild.yaml example that included both the pull and build with --cache-from would have helped me.

from cloud-builders.

jakobholmelund avatar jakobholmelund commented on July 28, 2024

yea.. figured it out right after writing.. sadly the pull step is really slow 😞 and in the end my build time only went down from 11 mins to around 8. still an improvement, but i was hoping for more.

from cloud-builders.

skelterjohn avatar skelterjohn commented on July 28, 2024

How big is your image and how long does it take to pull?

from cloud-builders.

jakobholmelund avatar jakobholmelund commented on July 28, 2024

i think my image is 1.6GB i have moved everything to us.gcr.io to try and get the pull time down, but it aint helping much. i'll have to try and slim down my image, i found out that i can slim it at least 400mb by removing some duplicated images.

from cloud-builders.

skelterjohn avatar skelterjohn commented on July 28, 2024

A 1.6GB image will likely take several minutes to download. If you point me at your build process I'd be happy to consult on slimming the image (one of my secret hobbies).

from cloud-builders.

jakobholmelund avatar jakobholmelund commented on July 28, 2024

The problem is that google hasn't found a way to add backend_buckets to ingress on GKE, so right now i'm uploading all of my static files to the docker image to get automatic CDN. And since i'm using django all my static files are duplicated for cache-busting. I'm currently working on moving my static files to cloud storage and for now it seems i have to pay for an extra load balancer to get CDN support for those files.

from cloud-builders.

skelterjohn avatar skelterjohn commented on July 28, 2024

If you have duplicated files in multiple layers, you might benefit from squashing them. See https://stackoverflow.com/questions/41764336/how-does-the-new-docker-squash-work

from cloud-builders.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.