docker build cache scope

This commit is contained in:
Brett McBride 2025-07-11 11:02:12 +10:00
parent cd6a8de3f5
commit 53adeff734
1 changed files with 6 additions and 5 deletions

View File

@ -18,6 +18,8 @@ jobs:
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
runs-on: ubuntu-latest
env:
CACHE_SCOPE: php-${{ matrix.php-version }}-${{ github.ref_name }}
permissions:
packages: write
contents: read
@ -45,9 +47,8 @@ jobs:
file: docker/Dockerfile
build-args: PHP_VERSION=${{ matrix.php-version }}
platforms: linux/amd64,linux/arm/v8,linux/arm64
tags: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${{ matrix.php-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_SCOPE }}
- name: Build and push ${{ matrix.php-version }} to ghcr.io
uses: docker/build-push-action@v6
@ -58,5 +59,5 @@ jobs:
build-args: PHP_VERSION=${{ matrix.php-version }}
platforms: linux/amd64,linux/arm/v8,linux/arm64
tags: ghcr.io/open-telemetry/opentelemetry-php/opentelemetry-php-base:${{ matrix.php-version }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,scope=${{ env.CACHE_SCOPE }}
cache-to: type=gha,mode=max,scope=${{ env.CACHE_SCOPE }}