feat(php-laravel-build-push): switch image cache from GHA to registry#117
Merged
Conversation
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.
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.
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.1sand neverCACHED.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):
:buildcache:buildcache-webserver:buildcache-cliBehavior change for consumers
:buildcache*package tag in GHCR (visibility inherits the repo's). Existingdocker/login-actionandPackages: writetoken cover both push and pull — no permission changes.Test plan
encodium/shoppingwarms the registry cache (will be cold first time, slow as today)encodium/shoppingmain → confirm#11 ... CACHEDfor the apk/pecl base layer and total app-image build < 1 minuteghcr.io/encodium/<repo>:buildcacheappears as a package on the repo