ci(docker): move BuildKit layer cache from GHA to GHCR registry

Merged
GR
9d ago
+32-7

Summary

Part 1 of the CI optimization series (from the 150-run audit).

Currently the repo's 10 GB GitHub Actions cache quota is 100% full (10.4 GB / 10.0 GB):

  • docker.yml buildkit-blob-* entries consume ~8.7 GB (4.1 GB + 3.0 GB + 1.1 GB + 0.5 GB)
  • CodeQL overlay databases consume ~1.4 GB

Because GHA cache is saturated, enabling sccache, uv, or ROCm SDK caching in ci.yml would cause immediate cache eviction.

Changes

  • Derive a lowercase GHCR buildcache ref (ghcr.io/<owner>/lucebox-hub:buildcache-<variant>) in Capture build identity.
  • Switch docker/bake-action from type=gha to type=registry:
    • cache-from reads the public GHCR buildcache image on all events (including fork PRs, no write permissions needed).
    • cache-to writes mode=max cache layers only on main / release / workflow_dispatch with push=true (where GHCR login already runs).

Expected Impact

  • Reclaims ~8.7 GB of the 10 GB GitHub Actions cache quota for ci.yml compiler (sccache) and dependency caches.
  • GHCR registry caching is unlimited for public repositories.
  • Follow-up after merge: delete stale buildkit-blob-* GHA cache entries once to immediately free quota.