Build both platforms in one action

This commit is contained in:
Aaron Reisman
2024-10-22 03:45:44 -05:00
committed by Aaron Reisman
parent 011efe3676
commit 9825e2b552
3 changed files with 19 additions and 23 deletions

View File

@@ -23,15 +23,7 @@ on:
jobs:
build_and_push:
runs-on: ubuntu-latest
strategy:
# Prevent a failure in one image from stopping the other builds
fail-fast: false
matrix:
os:
- ubuntu-latest
arch:
- amd64
- arm64
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -43,6 +35,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ inputs.release }}
uses: docker/login-action@v3
with:
username: ${{ secrets.docker_username }}
@@ -62,11 +55,9 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.arch }}
platforms: linux/amd64,linux/arm64
push: ${{ steps.metadata.outputs.tags != ''}}
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
TARGETARCH=${{ matrix.arch }}