Skip to content

Commit 58d3295

Browse files
authored
fix dotnet build (dockersamples#274)
1 parent 94c49c7 commit 58d3295

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

worker/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# (errors common in arm/v7 32bit) https://github.com/dotnet/dotnet-docker/issues/1537
44
# https://hub.docker.com/_/microsoft-dotnet
55
# hadolint ignore=DL3029
6+
# to build for a different platform than your host, use --platform=<platform>
7+
# for example, if you were on Intel (amd64) and wanted to build for ARM, you would use:
8+
# docker buildx build --platform "linux/arm64/v8" .
69
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build
710
ARG TARGETPLATFORM
811
ARG BUILDPLATFORM
@@ -13,6 +16,7 @@ COPY *.csproj .
1316
RUN case ${TARGETPLATFORM} in \
1417
"linux/amd64") ARCH=x64 ;; \
1518
"linux/arm64") ARCH=arm64 ;; \
19+
"linux/arm64/v8") ARCH=arm64 ;; \
1620
"linux/arm/v7") ARCH=arm ;; \
1721
esac \
1822
&& dotnet restore -r linux-${ARCH}
@@ -21,6 +25,7 @@ COPY . .
2125
RUN case ${TARGETPLATFORM} in \
2226
"linux/amd64") ARCH=x64 ;; \
2327
"linux/arm64") ARCH=arm64 ;; \
28+
"linux/arm64/v8") ARCH=arm64 ;; \
2429
"linux/arm/v7") ARCH=arm ;; \
2530
esac \
2631
&& dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore

0 commit comments

Comments
 (0)