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.
This commit is contained in:
Claude
2025-11-25 19:55:57 +00:00
parent d91ab436e8
commit f446335e81
+26 -4
View File
@@ -36,10 +36,21 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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 - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
platforms: linux/amd64,linux/arm64 platforms: ${{ steps.platforms.outputs.platforms }}
- name: Log in to Container Registry - name: Log in to Container Registry
if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' 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' }} push: ${{ (github.event_name != 'pull_request' || github.event.inputs.push == 'true') && steps.login-ghcr.outcome == 'success' }}
tags: ${{ steps.meta-backend.outputs.tags }} tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }} labels: ${{ steps.meta-backend.outputs.labels }}
platforms: linux/amd64,linux/arm64 platforms: ${{ steps.platforms.outputs.platforms }}
cache-from: type=gha,scope=backend cache-from: type=gha,scope=backend
cache-to: type=gha,mode=max,scope=backend cache-to: type=gha,mode=max,scope=backend
build-args: | build-args: |
@@ -116,10 +127,21 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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 - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
platforms: linux/amd64,linux/arm64 platforms: ${{ steps.platforms.outputs.platforms }}
- name: Log in to Container Registry - name: Log in to Container Registry
if: github.event_name != 'pull_request' || github.event.inputs.push == 'true' 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' }} push: ${{ (github.event_name != 'pull_request' || github.event.inputs.push == 'true') && steps.login-ghcr.outcome == 'success' }}
tags: ${{ steps.meta-frontend.outputs.tags }} tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }} labels: ${{ steps.meta-frontend.outputs.labels }}
platforms: linux/amd64,linux/arm64 platforms: ${{ steps.platforms.outputs.platforms }}
cache-from: type=gha,scope=frontend cache-from: type=gha,scope=frontend
cache-to: type=gha,mode=max,scope=frontend cache-to: type=gha,mode=max,scope=frontend
build-args: | build-args: |