From 4bef5a07373577323aae2c81f8d3368160a2b5a6 Mon Sep 17 00:00:00 2001 From: Tuomo Date: Sun, 25 Feb 2024 18:34:37 +0200 Subject: [PATCH] Improve container building For more details, see: https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/ --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9b1e42d..a2fb1f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim as build-env +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim as build-env +ARG TARGETARCH WORKDIR /App COPY . ./ -RUN dotnet restore -RUN dotnet publish -c Release --framework net8.0 +RUN dotnet restore -a $TARGETARCH +RUN dotnet publish -c Release --framework net8.0 -a $TARGETARCH --no-restore FROM mcr.microsoft.com/dotnet/runtime:8.0-bookworm-slim