feat: add Docker image layer caching between CI runs#78
Merged
Conversation
Uses docker/build-push-action with GitHub Actions cache backend to cache Docker layer builds across runs. Images are built once per job and tagged (node-test:22, node-test:24); spec_helper uses the pre-built image directly instead of rebuilding from source. On cache hit, the image build steps complete in seconds rather than pulling and compiling from scratch each run. Both Ruby matrix jobs share the same cache scopes, so the second job benefits immediately from the first job's cache write. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Caches Docker image layers between CI runs using the GitHub Actions cache backend, so repeated pushes build significantly faster.
What changed
.github/workflows/ruby.ymldocker/setup-buildx-actionto enable the GHA cache backenddocker/build-push-actionsteps that buildnode-test:22andnode-test:24withcache-from/cache-to: type=ghabefore running testsDOCKER_BUILDKIT: 1env var (Buildx enables BuildKit by default; Rakefile also sets it)cache-poisoningfinding — both Docker actions are pinned to exact commit SHAsspec/spec_helper.rbcreate_imagenow triesDocker::Image.get("node-test:#{version}")first; falls back tobuild_from_dirif the pre-built image isn't present (e.g. local development)How caching works
node22/node24cache-from: type=gharestores the cached layers — only changed layers are rebuiltTest plan
🤖 Generated with Claude Code