Skip to content

feat(php-laravel-build-push): switch image cache from GHA to registry#117

Merged
bryanspears merged 1 commit into
mainfrom
feat/php-laravel-registry-cache
Apr 24, 2026
Merged

feat(php-laravel-build-push): switch image cache from GHA to registry#117
bryanspears merged 1 commit into
mainfrom
feat/php-laravel-registry-cache

Conversation

@bryanspears
Copy link
Copy Markdown
Contributor

Summary

The GHA cache backend has a 10GB cap and parallel-job writes were evicting the heavy PHP base layer (apk + pecl + intl compile, ~145s) before the next build could read it — so app builds in encodium/shopping (and presumably webstore/internal_api) consistently took 4+ minutes with #11 [base 2/6] DONE 144.1s and never CACHED.

This switches all three image builds (app/webserver/cli) to a registry-cache backend in the calling repo's GHCR namespace via ${{ github.repository }}. No per-consumer config needed — it works automatically across every repo that uses this workflow.

Cache tags (distinct so the three images don't clobber each other):

  • App: :buildcache
  • Webserver: :buildcache-webserver
  • CLI: :buildcache-cli

Behavior change for consumers

  • First build after merge per repo: cold (no cache), no slower than today.
  • Steady state: should drop several minutes off PHP-heavy builds.
  • Each consumer repo gains a :buildcache* package tag in GHCR (visibility inherits the repo's). Existing docker/login-action and Packages: write token cover both push and pull — no permission changes.
  • The old GHA cache entries will age out naturally (no manual cleanup).

Test plan

  • Merge → confirm next build in encodium/shopping warms the registry cache (will be cold first time, slow as today)
  • Following push to encodium/shopping main → confirm #11 ... CACHED for the apk/pecl base layer and total app-image build < 1 minute
  • Spot-check a webstore or internal_api build for the same pattern
  • Confirm ghcr.io/encodium/<repo>:buildcache appears as a package on the repo

GHA cache backend's 10GB cap and per-job parallel writes were churning
the heavy PHP base layers (apk + pecl + intl compile, ~145s per build)
out of cache, so app image rebuilds were running cold every push.

Use the calling repo's GHCR namespace as a registry-cache backend
instead. No size cap, more reliable layer matching, and works
automatically across all consumers via ${{ github.repository }} —
no per-repo config needed.

Cache tags per image (so they don't clobber each other):
- App:       :buildcache
- Webserver: :buildcache-webserver
- CLI:       :buildcache-cli

First build after merge will be cold (no cache); subsequent builds
should drop several minutes.
@bryanspears bryanspears requested a review from a team as a code owner April 24, 2026 23:47
@bryanspears bryanspears requested a review from ronneseth April 24, 2026 23:47
@bryanspears bryanspears merged commit 626f189 into main Apr 24, 2026
1 check failed
@bryanspears bryanspears deleted the feat/php-laravel-registry-cache branch April 24, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant