Skip to content

Commit

Permalink
Properly set architecture when using --platform for CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
woldham-mgs committed Jul 28, 2024
1 parent 96cfc9d commit 0ccfbdc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ RUN dotnet restore "PKHaX.csproj"

COPY . .

ARG ARCHITECTURE=x64
RUN dotnet publish "PKHaX.csproj" -c Release -o /app/publish -r "linux-$ARCHITECTURE"
# This if logic is done to set the correct architecture for the runtime, dotnet publish needs x64 wheras Docker uses amd64
# TARGETARCH is automatically set by Docker when building the image with the --platform flag
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ] ; then export ARCH="x64" ; else export ARCH=$TARGETARCH ; fi; \
dotnet publish "PKHaX.csproj" -c Release -o /app/publish -r "linux-$ARCH"

FROM debian:12
WORKDIR /app
Expand Down

0 comments on commit 0ccfbdc

Please sign in to comment.