2121 REGISTRY : ghcr.io
2222 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : " true"
2323 PHP_BASE_MAX_AGE_DAYS : " 14"
24+ KING_CI_LOCAL_DOCKER_BUILDX_CACHE_DIR : /opt/king/cache/docker/buildx
2425
2526jobs :
2627 resolve-release-merge :
@@ -158,6 +159,13 @@ jobs:
158159 - name : Set up Docker Buildx
159160 uses : docker/setup-buildx-action@v4
160161
162+ - name : Resolve Docker Buildx cache
163+ id : base-buildx-cache
164+ run : |
165+ bash ./infra/scripts/resolve-docker-buildx-cache.sh \
166+ --scope "php-base-${{ matrix.php-version }}" \
167+ --github-output "${GITHUB_OUTPUT}"
168+
161169 - name : Log in to Container Registry
162170 uses : docker/login-action@v4
163171 with :
@@ -251,11 +259,18 @@ jobs:
251259 push : true
252260 tags : ${{ steps.meta-base.outputs.ref }}
253261 labels : ${{ steps.meta-base.outputs.labels }}
254- cache-from : type=gha
255- cache-to : type=gha,mode=max
262+ cache-from : ${{ steps.base-buildx-cache.outputs.cache-from }}
263+ cache-to : ${{ steps.base-buildx-cache.outputs.cache-to }}
256264 build-args : |
257265 PHP_VERSION=${{ matrix.php-version }}
258266
267+ - name : Commit local Docker Buildx cache
268+ if : steps.decide-base.outputs.rebuild == 'true' && steps.base-buildx-cache.outputs.use-local-cache == 'true'
269+ run : |
270+ bash ./infra/scripts/commit-docker-buildx-cache.sh \
271+ --cache-dir "${{ steps.base-buildx-cache.outputs.local-cache-dir }}" \
272+ --next-dir "${{ steps.base-buildx-cache.outputs.local-cache-next-dir }}"
273+
259274 build-release-packages :
260275 name : Build release artifacts for ${{ matrix.php-version }} / ${{ matrix.arch-label }}
261276 needs :
@@ -722,6 +737,13 @@ jobs:
722737 - name : Set up Docker Buildx
723738 uses : docker/setup-buildx-action@v4
724739
740+ - name : Resolve Docker Buildx cache
741+ id : dockerhub-buildx-cache
742+ run : |
743+ bash ./infra/scripts/resolve-docker-buildx-cache.sh \
744+ --scope "dockerhub-runtime-php8.5" \
745+ --github-output "${GITHUB_OUTPUT}"
746+
725747 - name : Log in to Docker Hub
726748 uses : docker/login-action@v4
727749 with :
@@ -744,14 +766,21 @@ jobs:
744766 push : true
745767 tags : ${{ steps.meta-dockerhub.outputs.tags }}
746768 labels : ${{ steps.meta-dockerhub.outputs.labels }}
747- cache-from : type=gha
748- cache-to : type=gha,mode=max
769+ cache-from : ${{ steps.dockerhub-buildx-cache.outputs.cache-from }}
770+ cache-to : ${{ steps.dockerhub-buildx-cache.outputs.cache-to }}
749771 build-args : |
750772 PHP_VERSION=8.5
751773 PHP_BASE_IMAGE=${{ steps.meta-dockerhub.outputs.php_base_image }}
752774 BUILD_DATE=${{ steps.meta-dockerhub.outputs.created_at }}
753775 VCS_REF=${{ needs.resolve-release-merge.outputs.release-commit }}
754776
777+ - name : Commit local Docker Buildx cache
778+ if : steps.dockerhub-buildx-cache.outputs.use-local-cache == 'true'
779+ run : |
780+ bash ./infra/scripts/commit-docker-buildx-cache.sh \
781+ --cache-dir "${{ steps.dockerhub-buildx-cache.outputs.local-cache-dir }}" \
782+ --next-dir "${{ steps.dockerhub-buildx-cache.outputs.local-cache-next-dir }}"
783+
755784 - name : Generate Docker Hub runtime CVE inventory
756785 id : dockerhub-cve-inventory
757786 run : |
@@ -867,6 +896,13 @@ jobs:
867896 - name : Set up Docker Buildx
868897 uses : docker/setup-buildx-action@v4
869898
899+ - name : Resolve Docker Buildx cache
900+ id : runtime-buildx-cache
901+ run : |
902+ bash ./infra/scripts/resolve-docker-buildx-cache.sh \
903+ --scope "runtime-php${{ matrix.php-version }}" \
904+ --github-output "${GITHUB_OUTPUT}"
905+
870906 - name : Log in to Container Registry
871907 uses : docker/login-action@v4
872908 with :
@@ -883,10 +919,17 @@ jobs:
883919 push : true
884920 tags : ${{ steps.meta.outputs.tags }}
885921 labels : ${{ steps.meta.outputs.labels }}
886- cache-from : type=gha
887- cache-to : type=gha,mode=max
922+ cache-from : ${{ steps.runtime-buildx-cache.outputs.cache-from }}
923+ cache-to : ${{ steps.runtime-buildx-cache.outputs.cache-to }}
888924 build-args : |
889925 PHP_VERSION=${{ matrix.php-version }}
890926 PHP_BASE_IMAGE=${{ steps.meta.outputs.php_base_image }}
891927 BUILD_DATE=${{ steps.meta.outputs.created_at }}
892928 VCS_REF=${{ needs.resolve-release-merge.outputs.release-commit }}
929+
930+ - name : Commit local Docker Buildx cache
931+ if : steps.runtime-buildx-cache.outputs.use-local-cache == 'true'
932+ run : |
933+ bash ./infra/scripts/commit-docker-buildx-cache.sh \
934+ --cache-dir "${{ steps.runtime-buildx-cache.outputs.local-cache-dir }}" \
935+ --next-dir "${{ steps.runtime-buildx-cache.outputs.local-cache-next-dir }}"
0 commit comments