refactor: dockerfile caching (#30874)

This commit is contained in:
Jason Rasmussen 2026-08-19 16:52:50 -04:00 committed by GitHub
parent 7165eb61eb
commit 47dccf7283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 27 deletions

View file

@ -397,6 +397,7 @@ jobs:
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
defaults:
run:
working-directory: ./e2e
@ -440,8 +441,33 @@ jobs:
run: pnpm install --frozen-lockfile
if: ${{ !cancelled() }}
- name: Setup Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
if: ${{ github.event_name == 'push' && !github.event.pull_request.head.repo.fork }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve build cache
id: cache
run: |
ref=ghcr.io/immich-app/immich-server-build-cache:e2e-main-${{ runner.arch }}
echo "ref=$ref" >> "$GITHUB_OUTPUT"
if docker buildx imagetools inspect "$ref" > /dev/null 2>&1; then
echo "from=type=registry,ref=$ref" >> "$GITHUB_OUTPUT"
else
echo "from=" >> "$GITHUB_OUTPUT"
fi
- name: Start Docker Compose
id: docker
env:
E2E_CACHE_FROM: ${{ steps.cache.outputs.from }}
E2E_CACHE_TO: ${{ github.event_name == 'push' && !github.event.pull_request.head.repo.fork && format('type=registry,ref={0},mode=max', steps.cache.outputs.ref) || '' }}
run: docker compose up -d --build --renew-anon-volumes --force-recreate --remove-orphans --wait --wait-timeout 300
if: ${{ !cancelled() }}
@ -519,8 +545,24 @@ jobs:
run: pnpm exec playwright install chromium --only-shell
if: ${{ !cancelled() }}
- name: Setup Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Resolve build cache
id: cache
run: |
ref=ghcr.io/immich-app/immich-server-build-cache:e2e-main-${{ runner.arch }}
echo "ref=$ref" >> "$GITHUB_OUTPUT"
if docker buildx imagetools inspect "$ref" > /dev/null 2>&1; then
echo "from=type=registry,ref=$ref" >> "$GITHUB_OUTPUT"
else
echo "from=" >> "$GITHUB_OUTPUT"
fi
- name: Docker build
id: docker
env:
E2E_CACHE_FROM: ${{ steps.cache.outputs.from }}
run: docker compose up -d --build --renew-anon-volumes --force-recreate --remove-orphans --wait --wait-timeout 300
if: ${{ !cancelled() }}