[CI] Use Blacksmith Docker layer caching for image builds - #2
Merged
Conversation
The GHCR publish builds used type=gha buildx caching with mode=max across four scopes (app/worker x amd64/arm64). The exported layers overflow GitHub's 10GB per-repo Actions cache, and GHA cache reads are scoped to the run's own ref plus the default branch, so develop/main/tag publishes of the same commit each re-exported the full cache set and evicted each other. In practice every build (ARM especially) rebuilt from scratch and then spent ~3.5 minutes uploading a cache export that rarely survived until the next run. CI's Dockerfile build read from a gha scope that no workflow writes, so it never hit either. Switch both workflows to Blacksmith's persistent builder (useblacksmith/setup-docker-builder + useblacksmith/build-push-action), which mounts an NVMe-backed layer cache on the runner keyed per repo/Dockerfile/arch: no size cap, no ref scoping, and no cache export upload step.
|
No code issues found. See task Reviewed the swap to Blacksmith's persistent builder in Two non-blocking observations (no change requested):
|
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.
Problem
GHCR image builds almost never hit their Docker layer cache. Diagnosed from run 28962359037:
type=ghabuildx caching withmode=maxacross four scopes (app/worker × amd64/arm64). The exported layers total more than GitHub's 10GB per-repo Actions cache cap (the repo was sitting at 10.55GB with LRU eviction active).develop,main, and av*tag re-exported the full multi-GB cache set three times under three refs, evicting each other.ghascope that no workflow writes, so it never hit either.Change
Switch both workflows to Blacksmith's persistent builder (
useblacksmith/setup-docker-builder@v1+useblacksmith/build-push-action@v2, a drop-in fork ofdocker/build-push-action):cache-from/cache-todirectives.docker/setup-buildx-actionsince it only runsimagetools create.The existing native-runner matrix (no QEMU) and push-by-digest flow are unchanged; the Blacksmith action exposes the same
digestoutput.Expected impact
Warm builds should drop from ~8-10 min per arch to roughly image-push time. The first run per Dockerfile/arch is a cold cache and will still take full build time.
Validation
pnpm lint(prettier) passes on the edited workflows; pre-push hook (lint:fast, check-types:fast, knip) passed.