perf(docker): cache image builds through cache mounts and GHA cache #4020
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
These changes improve the performance of our Docker image building process by enabling the reuse of cached results from previous runs in two ways:
COPY
instruction.The first improvement can significantly enhance the developer experience during local builds. The second builds upon the first to bring similar benefits to our CI environment.
That said, expectations on the CI case should be tempered. Accessing the GitHub Actions cache introduces some performance overhead, and we are already using the 10 GiB limit for cache artifacts. As a result, hit rates are expected to be low (<40%), and the overall speedup can be minimal. Still, there is no noticeable downside, and this setup offers an easy opportunity to gain speed improvements without additional compute. Combined with the improved local development experience, this seems like the right call to make.