Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Container Builder: How to cache dependencies between two builds

We are migrating our container building process to Google Container Builder. We have multiple repo using Node or Scala.

As of actual container builder features, is it possible to cache dependencies between two builds (ex: node_modules, .ivy, ...). It's really time (money) consuming to download everything each time.

I know it's possible to build a custom docker image with all packaged within, but we would prefer avoiding this solution.

For example can we mount a persistent volume for that purpose, as we used to do with DroneIO? or even better automatically like in Bitbucket Pipelines?

Thanks

like image 626
mlardeur Avatar asked Sep 28 '17 09:09

mlardeur


People also ask

How does Kaniko cache work?

Kaniko cache works as follows: Cloud Build uploads container image layers directly to the registry as they are built so there is no explicit push step. If all layers are built successfully, an image manifest containing those layers is written to the registry.

What is the best approach to speed up the installation process of application dependencies in a Docker?

The easiest way to increase the speed of your Docker image build is by specifying a cached image that can be used for subsequent builds. You can specify the cached image by adding the --cache-from argument in your build config file, which will instruct Docker to build using that image as a cache source.

What is cloud build trigger?

A Cloud Build trigger automatically starts a build whenever you make any changes to your source code. You can configure the trigger to build your code on any changes to the source repository or only changes that match certain criteria.

What does Gcloud builds submit do?

gcloud builds submit --region=us-west2 --config cloudbuild. yaml . gcloudignore: When including source code for the build, the above command uploads all of the files in the specified directory to Google Cloud Platform to build. If you want to exclude certain files in the directory, you can include a file named .


1 Answers

GCB doesn't currently support mounting a persistent volume across builds.

In the meantime, the team recently published a document outlining some options for speeding up builds, which might be useful: https://cloud.google.com/container-builder/docs/speeding-up-builds

In particular, caching generated output to Google Cloud Storage and pulling it in at the beginning of your build might help in your case.

like image 101
Jason Hall Avatar answered Sep 26 '22 15:09

Jason Hall