diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 5e061fcc95..4f20c4109b 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -1,4 +1,5 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0.204-cbl-mariner2.0 AS build +# --platform tells docker to always use the host platform for the build not the target platform. Runtime container will use target platform. +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.204-cbl-mariner2.0 AS build ARG FHIR_VERSION ARG ASSEMBLY_VER @@ -67,8 +68,9 @@ RUN dotnet restore ./src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Hea COPY . . -RUN dotnet publish /repo/src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Health.Fhir.${FHIR_VERSION}.Web.csproj -c Release -o "/build" --no-restore -p:AssemblyVersion="${ASSEMBLY_VER}" -p:FileVersion="${ASSEMBLY_VER}" -p:Version="${ASSEMBLY_VER}" -f net8.0 +RUN dotnet publish /repo/src/Microsoft.Health.Fhir.${FHIR_VERSION}.Web/Microsoft.Health.Fhir.${FHIR_VERSION}.Web.csproj -c Release -o "/build" --no-restore -p:AssemblyVersion="${ASSEMBLY_VER}" -p:FileVersion="${ASSEMBLY_VER}" -p:Version="${ASSEMBLY_VER}" -f net8.0 -a $TARGETARCH +# Implicitly uses the target platform for the runtime image. FROM mcr.microsoft.com/dotnet/aspnet:8.0.4-cbl-mariner2.0 AS runtime ARG FHIR_VERSION