Your team has an application built by using a Dockerfile. The build is executed from Cloud Build, and the resulting artifacts are stored in Artifact Registry. Your team is reporting that builds are slow. You need to increase build speed, while following Google-recommended practices. What should you do?
To speed up Docker builds, optimize layer caching. Google Cloud recommends using --cache-from with Artifact Registry, and placing frequently changed files late in the Dockerfile so earlier layers can be reused.
''Put instructions that are less likely to change (like installing packages) early in the Dockerfile, and more frequently changing lines (like copying app code) near the end.''
--- Dockerfile Best Practices
''Use the --cache-from argument to pull layers from previously built images in Artifact Registry.''
--- Cloud Build Docker Caching
This dramatically reduces build time by avoiding redundant rebuilds of static layers.
Currently there are no comments in this discussion, be the first to comment!