How do I enable layer-caching on Google Cloud Build using only a Dockerfile?

Viewed 283

I'm using Google Cloud Build to build a series of upstream projects that I modify a little. I want to enable layer caching without adding a cloudbuild.yaml.

  • Project builds are specified using a Dockerfile, not a cloudbuild.yaml.
  • Upstream won't accept adding a cloudbuild.yaml
  • Everything is working well with this setup, except many of the images take 30 minutes or more to build because layer caching is not enabled.

The approach is simple if I could use cloudbuild.yaml: https://cloud.google.com/cloud-build/docs/speeding-up-builds

Is there a way to enable layer caching by default for all my cloud build Dockerfile projects? Or something I can modify slightly in the Dockerfiles?

0 Answers
Related