ci(demo): registry mode=max build cache for ARC (fix ~3h cold builds)#9786
Conversation
…ding cold The self-hosted (ARC) demo image builds were taking ~3h (never finishing) vs ~30m before, because every build reinstalled+recompiled all deps from scratch: - cache-to: type=inline only stores the FINAL image stage, so the expensive multi-stage yarn-install / native-module layers were never cached; - driver: docker (classic builder) can't import registry cache at all. Switch each job to the default docker-container buildx driver and push a mode=max layer cache to a dedicated :buildcache tag on GHCR. mode=max caches every stage (incl. the 30-100min yarn-install layers), and because the cache lives in the registry it is restored by every fresh ephemeral runner. A GHCR login is moved before the Build step so cache-to can push. First run after merge is still cold (populates :buildcache); subsequent runs reuse it and should drop back to minutes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThis PR updates the demo Docker build-publish GitHub Actions workflow to use registry-based build caching. It adds a GHCR login step before each of the gauzy-api, gauzy-webapp, and gauzy-worker builds, and replaces inline caching with cache-from/cache-to entries referencing ChangesDocker Build Cache Migration
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| - name: Login to GitHub Container Registry (build cache) | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| driver: docker | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Redundant GHCR login steps per job
Each of the three jobs now contains two identical docker/login-action@v4 calls for GHCR — the new one added before the build (lines 29–34 in gauzy-api, similar locations in the other two jobs) and the pre-existing one used before the final push (e.g., lines 92–97). The login-action writes credentials to Docker's credential store, which persists for the entire job, so the second call is a no-op. Since both use the same GITHUB_TOKEN, you can safely remove the later "Login to GitHub Container Registry" step in each job (or alternatively, drop the newly added one and move the existing one above the build step).
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
🤖 Augment PR SummarySummary: Improves ARC demo Docker build times by switching to registry-backed Buildx caching so expensive multi-stage dependency installs are reused across ephemeral runners. Changes:
Technical Notes: 🤖 Was this summary useful? React with 👍 or 👎 |
| # supports inline (final-stage) cache, which is why the yarn-install stages were cold. | ||
| cache-from: | | ||
| type=registry,ref=ghcr.io/ever-co/gauzy-api-demo:buildcache | ||
| type=registry,ref=ghcr.io/ever-co/gauzy-api-demo:latest |
There was a problem hiding this comment.
In .github/workflows/docker-build-publish-demo.yml, cache-from: type=registry,ref=...:latest may stop being a useful fallback now that cache-to no longer exports type=inline, since the :latest image may not carry BuildKit cache metadata. If the :buildcache tag is missing/expired, this could lead to unexpectedly cold builds despite the "fallback" entry.
Severity: low
Other Locations
.github/workflows/docker-build-publish-demo.yml:154.github/workflows/docker-build-publish-demo.yml:254
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.



Why
The
docker-build-publish-demo.ymljobs (gauzy-api,gauzy-webapp,gauzy-worker) on the self-hosted ARC runners were running ~3h and getting cancelled without finishing — vs ~30 min previously. Root cause, confirmed from the build log (run 28782300929):yarn installfully cold — one stage logged#100 4296.6(71 min) and the worker#100 6015.6(100 min) in a single install, plus native recompiles (bcrypt,better-sqlite3,@sentry/profiling-node).cache-to: type=inlineonly stores the final image stage, so the expensive multi-stagedependencies/proddependencies(yarn install) layers were never cached.driver: docker(on the api + worker jobs) uses the classic builder, which can't import registry cache effectively.What
For each of the 3 jobs:
driver: docker→ use the defaultdocker-containerbuildx driver (required formode=max).cache-to: type=registry,ref=…:buildcache,mode=max— caches all stages (incl. the yarn-install layers) to a dedicated:buildcachetag.cache-fromnow reads:buildcache(with:latestas fallback).cache-tocan push the cache.Because the cache lives in GHCR, it's restored by every fresh ephemeral runner — this is the cross-runner cache persistence. First run after merge is still cold (it populates
:buildcache); subsequent runs should drop back to minutes.Notes
Set up QEMUis left as-is; it's unused (platforms: linux/amd64) and could be removed in a follow-up to shave ~2 min.-8runner pool now guarantees the build 8 vCPU / 16 GiB (the docker build runs in the dind sidecar, which previously had no resource limits).🤖 Generated with Claude Code
Summary by cubic
Fix ARC demo Docker builds by enabling registry-backed Buildx cache (
mode=max) and dropping the classic Docker driver. This stops coldyarn installstages and returns builds to minutes.gauzy-api,gauzy-webapp, andgauzy-workerdemo jobs on ARC.driver: dockerto Buildxdocker-container.:buildcachewithcache-to: type=registry,mode=maxandcache-from(fallback to:latest).Written for commit 869ac19. Summary will update on new commits.