From f446335e81f4423e9243a4f33fb5729ad8380ab4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 25 Nov 2025 19:55:57 +0000 Subject: [PATCH] Fix CI/CD: Build amd64 only for PRs to avoid QEMU ARM64 emulation issues Sharp library native binaries cause QEMU 'Illegal instruction' errors during ARM64 emulation. This change builds only amd64 for PR checks (faster, reliable) while maintaining multi-arch (amd64+arm64) builds for main/develop/tags. --- .github/workflows/docker-build.yml | 34 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index deb67d2..6a1c455 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -31,15 +31,26 @@ jobs: contents: read packages: write security-events: write - + steps: - name: Checkout code uses: actions/checkout@v4 + - name: Determine build platforms + id: platforms + run: | + # For PRs, build only amd64 to avoid QEMU emulation issues with Sharp + # For main/develop/tags, build multi-arch + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "platforms=linux/amd64" >> $GITHUB_OUTPUT + else + echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT + fi + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: - platforms: linux/amd64,linux/arm64 + platforms: ${{ steps.platforms.outputs.platforms }} - name: Log in to Container Registry if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' @@ -79,7 +90,7 @@ jobs: push: ${{ (github.event_name != 'pull_request' || github.event.inputs.push == 'true') && steps.login-ghcr.outcome == 'success' }} tags: ${{ steps.meta-backend.outputs.tags }} labels: ${{ steps.meta-backend.outputs.labels }} - platforms: linux/amd64,linux/arm64 + platforms: ${{ steps.platforms.outputs.platforms }} cache-from: type=gha,scope=backend cache-to: type=gha,mode=max,scope=backend build-args: | @@ -111,15 +122,26 @@ jobs: contents: read packages: write security-events: write - + steps: - name: Checkout code uses: actions/checkout@v4 + - name: Determine build platforms + id: platforms + run: | + # For PRs, build only amd64 to avoid QEMU emulation issues + # For main/develop/tags, build multi-arch + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + echo "platforms=linux/amd64" >> $GITHUB_OUTPUT + else + echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT + fi + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: - platforms: linux/amd64,linux/arm64 + platforms: ${{ steps.platforms.outputs.platforms }} - name: Log in to Container Registry if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' @@ -159,7 +181,7 @@ jobs: push: ${{ (github.event_name != 'pull_request' || github.event.inputs.push == 'true') && steps.login-ghcr.outcome == 'success' }} tags: ${{ steps.meta-frontend.outputs.tags }} labels: ${{ steps.meta-frontend.outputs.labels }} - platforms: linux/amd64,linux/arm64 + platforms: ${{ steps.platforms.outputs.platforms }} cache-from: type=gha,scope=frontend cache-to: type=gha,mode=max,scope=frontend build-args: |