#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Fix PR docker CI when the base image changes (#6809)
Anthony Stirlingd508bc41bfca
diff --git a/.github/workflows/docker-compose-tests.yml b/.github/workflows/docker-compose-tests.ymlindex faa3c2a280..155b990b32 100644--- a/.github/workflows/docker-compose-tests.yml+++ b/.github/workflows/docker-compose-tests.yml@@ -64,11 +64,19 @@ jobs:gradle-version: 9.6.0cache-disabled: true+ # When the PR changes the base image, test.sh builds it locally+ # (stirling-pdf-base:local) into the daemon image store. A buildx+ # container builder can't see that store, so skip it here and let+ # `docker buildx build` fall back to the default docker driver, which+ # resolves the local base. The gha cache backend is also skipped (its+ # runtime token isn't exposed) since the docker driver can't use it.- name: Set up Docker Buildx+ if: inputs.docker-base-changed != 'true'uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0# Expose ACTIONS_RUNTIME_TOKEN / ACTIONS_RESULTS_URL for docker buildx type=gha cache backend.- name: Expose GitHub runtime for Buildx cache+ if: inputs.docker-base-changed != 'true'uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0- name: Install Docker Composediff --git a/.github/workflows/test-build-docker.yml b/.github/workflows/test-build-docker.ymlindex 4fd00a494c..b6a081bb1e 100644--- a/.github/workflows/test-build-docker.yml+++ b/.github/workflows/test-build-docker.yml@@ -155,6 +155,19 @@ jobs:echo "platforms=linux/amd64,linux/arm64/v8" >> "$GITHUB_OUTPUT"fi+ # Base-changed PRs build the embedded image with the local docker driver+ # so the locally-built stirling-pdf-base:pr-test (in the daemon image+ # store) resolves. A buildx container builder cannot see it and would try+ # to pull it from a registry, which fails. Single-platform, no gha cache.+ - name: Build ${{ matrix.docker-rev }} against local base (PR base change)+ if: github.event_name == 'pull_request' && inputs.docker-base-changed == 'true'+ run: |+ DOCKER_BUILDKIT=1 docker build \+ --build-arg BASE_IMAGE=${{ steps.build-params.outputs.base_image }} \+ --file ./${{ matrix.docker-rev }} \+ --tag stirling-pdf-embedded:pr-test \+ .+- name: Build ${{ matrix.docker-rev }} (Depot)if: env.USE_DEPOT == 'true'uses: depot/build-push-action@98e78adca7817480b8185f474a400b451d74e287 # v1.16.0@@ -169,8 +182,10 @@ jobs:provenance: truesbom: true+ # Fork PRs that did NOT change the base use the buildx container builder+ # (multi-platform + gha cache) against the published base image.- name: Build ${{ matrix.docker-rev }} (Docker fork fallback)- if: env.USE_DEPOT != 'true'+ if: env.USE_DEPOT != 'true' && inputs.docker-base-changed != 'true'uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0with:builder: ${{ steps.buildx.outputs.name }}