From faaa2469cd492d318b99c93e0291da6dd1640f98 Mon Sep 17 00:00:00 2001 From: David Krammer Date: Fri, 6 Sep 2024 18:32:12 +0200 Subject: [PATCH] #512: Make Dockerfile arch specific --- Frontend/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile index 9d64c6f4c..14a937969 100644 --- a/Frontend/Dockerfile +++ b/Frontend/Dockerfile @@ -1,13 +1,14 @@ ################## BUILD ################## -FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build +ARG TARGETARCH WORKDIR /src COPY . . -RUN dotnet restore "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -RUN dotnet build "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -c Release -o /app/build +RUN dotnet restore "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -a $TARGETARCH +RUN dotnet build "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -c Release -o /app/build -a $TARGETARCH ################# PUBLISH ################# FROM build AS publish -RUN dotnet publish "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -c Release -o /app/publish +RUN dotnet publish "Xipona.Frontend.WebApp/Xipona.Frontend.WebApp.csproj" -c Release -o /app/publish --no-restore -sc false -a $TARGETARCH ################## FINAL ################## FROM nginxinc/nginx-unprivileged:1.25 AS final @@ -15,4 +16,4 @@ WORKDIR /usr/share/nginx/html COPY --from=publish /app/publish . COPY Docker/nginx.conf /etc/nginx/nginx.conf -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"]