From 93ee0a516c55d78fa924dc77e97e596f591513a6 Mon Sep 17 00:00:00 2001 From: Bret Fisher Date: Fri, 16 Dec 2022 22:06:39 -0500 Subject: [PATCH] fix dotnet build (#274) --- worker/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/worker/Dockerfile b/worker/Dockerfile index b53da1b..fff3913 100644 --- a/worker/Dockerfile +++ b/worker/Dockerfile @@ -3,6 +3,9 @@ # (errors common in arm/v7 32bit) https://github.com/dotnet/dotnet-docker/issues/1537 # https://hub.docker.com/_/microsoft-dotnet # hadolint ignore=DL3029 +# to build for a different platform than your host, use --platform= +# for example, if you were on Intel (amd64) and wanted to build for ARM, you would use: +# docker buildx build --platform "linux/arm64/v8" . FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build ARG TARGETPLATFORM ARG BUILDPLATFORM @@ -13,6 +16,7 @@ COPY *.csproj . RUN case ${TARGETPLATFORM} in \ "linux/amd64") ARCH=x64 ;; \ "linux/arm64") ARCH=arm64 ;; \ + "linux/arm64/v8") ARCH=arm64 ;; \ "linux/arm/v7") ARCH=arm ;; \ esac \ && dotnet restore -r linux-${ARCH} @@ -21,6 +25,7 @@ COPY . . RUN case ${TARGETPLATFORM} in \ "linux/amd64") ARCH=x64 ;; \ "linux/arm64") ARCH=arm64 ;; \ + "linux/arm64/v8") ARCH=arm64 ;; \ "linux/arm/v7") ARCH=arm ;; \ esac \ && dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore