Skip to content

Commit

Permalink
Build both platforms in one action
Browse files Browse the repository at this point in the history
  • Loading branch information
pixil98 committed Oct 22, 2024
1 parent 011efe3 commit e0403e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -62,11 +54,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 }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Dockerfile
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETARCH=amd64

RUN echo "ARCH: $TARGETARCH"

COPY Source /Source
RUN dotnet publish \
Expand Down

0 comments on commit e0403e4

Please sign in to comment.