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: |