From a78a0705f000178a585f3ce8645204c14c62e44d Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:07:12 +0100 Subject: [PATCH] Add real support for multiarch (#163) * Fix build for ARM64 * Fix Docker warnings (FromAsCasing) * Fix build for ARM64 - part 2 --------- Co-authored-by: Alexander --- src/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index 5192cb1..93e0e33 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,5 +1,8 @@ # Stage 1: Build -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine as source + +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS source +ARG TARGETARCH + ARG target="Release" RUN apk add --no-cache unzip curl bash @@ -10,16 +13,17 @@ COPY ./getui.sh ./getui.sh RUN ./getui.sh COPY ./OpenIdConnectServerMock.csproj ./OpenIdConnectServerMock.csproj -RUN dotnet restore +RUN dotnet restore -a $TARGETARCH COPY . . -RUN dotnet publish -c $target -o obj/docker/publish +RUN dotnet publish -a $TARGETARCH -c $target -o obj/docker/publish RUN cp -r /src/obj/docker/publish /OpenIdConnectServerMock # Stage 2: Release -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-alpine as release +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS release + ARG target="Release" RUN apk add --no-cache curl