diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 2b1b6807..759a56e6 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -82,7 +82,8 @@ jobs: tags: cloudflare/sandbox:${{ steps.package-version.outputs.version }} cache-from: | type=gha,scope=preview-pr-${{ github.event.pull_request.number }} - type=gha,scope=pr-${{ github.event.pull_request.number }} + type=gha,scope=pr-${{ github.event.pull_request.number }}-amd64 + type=gha,scope=release-amd64 type=gha,scope=release cache-to: type=gha,mode=max,scope=preview-pr-${{ github.event.pull_request.number }} build-args: | diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 1a024bc1..3138cb55 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -120,12 +120,13 @@ jobs: with: context: . file: packages/sandbox/Dockerfile + platforms: linux/amd64 # Explicit single-arch for compatibility with release-amd64 cache load: true # Load into Docker daemon for local testing tags: cloudflare/sandbox-test:${{ needs.unit-tests.outputs.version || '0.0.0' }} cache-from: | - type=gha,scope=pr-${{ github.event.pull_request.number }} - type=gha,scope=release - cache-to: type=gha,mode=max,scope=pr-${{ github.event.pull_request.number }} + type=gha,scope=pr-${{ github.event.pull_request.number }}-amd64 + type=gha,scope=release-amd64 + cache-to: type=gha,mode=max,scope=pr-${{ github.event.pull_request.number }}-amd64 build-args: | SANDBOX_VERSION=${{ needs.unit-tests.outputs.version || '0.0.0' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec123771..581118a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,6 +113,18 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and cache single-arch image (for PR cache reuse) + uses: docker/build-push-action@v6 + with: + context: . + file: packages/sandbox/Dockerfile + platforms: linux/amd64 + push: false # Don't push, just cache + cache-from: type=gha,scope=release-amd64 + cache-to: type=gha,mode=max,scope=release-amd64 + build-args: | + SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }} + - name: Build and push Docker image (beta) uses: docker/build-push-action@v6 with: @@ -121,7 +133,9 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: cloudflare/sandbox:${{ needs.unit-tests.outputs.version }}-beta - cache-from: type=gha,scope=release + cache-from: | + type=gha,scope=release-amd64 + type=gha,scope=release cache-to: type=gha,mode=max,scope=release build-args: | SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }} @@ -170,6 +184,18 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and cache single-arch image (for PR cache reuse) + uses: docker/build-push-action@v6 + with: + context: . + file: packages/sandbox/Dockerfile + platforms: linux/amd64 + push: false # Don't push, just cache + cache-from: type=gha,scope=release-amd64 + cache-to: type=gha,mode=max,scope=release-amd64 + build-args: | + SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }} + - name: Build and push Docker image uses: docker/build-push-action@v6 with: @@ -178,7 +204,9 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: cloudflare/sandbox:${{ needs.unit-tests.outputs.version }} - cache-from: type=gha,scope=release + cache-from: | + type=gha,scope=release-amd64 + type=gha,scope=release cache-to: type=gha,mode=max,scope=release build-args: | SANDBOX_VERSION=${{ needs.unit-tests.outputs.version }}