CI: cache Docker layers and parallelize image builds#43
Merged
Conversation
The `docker` job rebuilt both images from scratch every run on ephemeral runners with no persistent layer cache. The webproxy xcaddy build (~11 min) and the card image's go mod download / npm ci / apt layers were redone on every PR. - Split into parallel `docker-card` and `docker-webproxy` jobs. - Use docker/build-push-action@v6 with GHA layer cache (type=gha) under distinct scopes so the two images don't evict each other. - docker-webproxy drops `needs:` — it's pure Caddy, independent of the Go and frontend gates, so it starts at t=0. - Pin webproxy base images to caddy:2.11.4(-builder) for stable cache keys. - Bump version 0.22.1 -> 0.22.2. Effect: unchanged webproxy is a near-instant cache hit; a typical PR's Docker phase drops from ~15 min to roughly the card compile alone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 17, 2026
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
The
dockerCI job rebuilt both images from scratch on every run. GitHub runners are ephemeral and the job used plaindocker buildwith no persistent layer cache, so every PR redid:xcaddybuild (~11 min) — recompiling Caddy + thecaddy-ratelimitplugin, even though that 5-line Dockerfile almost never changes;go mod download,npm ci, andapt-get installlayers (work thebuild/frontendgate jobs already did);The
--mount=type=cachemounts in both Dockerfiles are dead weight in CI — they only live for one BuildKit instance, which dies with the runner.Changes
docker/setup-buildx-action+docker/build-push-action@v6withcache-from/to: type=gha. Unchanged layers (xcaddy build,go mod download,npm ci, apt) are reused across runs.docker-cardanddocker-webproxy, each with its own cachescopeso they don't evict each other in the 10 GB GHA cache.docker-webproxydropsneeds:— it's pure Caddy, independent of the Go/frontend gates, so it starts at t=0 instead of after they finish.caddy:2.11.4(-builder)(were the floatingcaddy:builder/caddy:latest) for stable cache keys and reproducibility.0.22.1→0.22.2.Push/login behaviour is unchanged: images still push to Docker Hub only on push to
main, andreleasenow waits on both new jobs (needs: [docker-card, docker-webproxy]).Effect
A typical PR (webproxy untouched, card source changed) drops the Docker phase from ~15 min to roughly the card compile alone (~2–3 min), with webproxy a near-instant cache hit running in parallel.
Verification
ci.ymlparses as valid YAML.🤖 Generated with Claude Code