File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 3
3
# (errors common in arm/v7 32bit) https://github.com/dotnet/dotnet-docker/issues/1537
4
4
# https://hub.docker.com/_/microsoft-dotnet
5
5
# 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" .
6
9
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build
7
10
ARG TARGETPLATFORM
8
11
ARG BUILDPLATFORM
@@ -13,6 +16,7 @@ COPY *.csproj .
13
16
RUN case ${TARGETPLATFORM} in \
14
17
"linux/amd64" ) ARCH=x64 ;; \
15
18
"linux/arm64" ) ARCH=arm64 ;; \
19
+ "linux/arm64/v8" ) ARCH=arm64 ;; \
16
20
"linux/arm/v7" ) ARCH=arm ;; \
17
21
esac \
18
22
&& dotnet restore -r linux-${ARCH}
@@ -21,6 +25,7 @@ COPY . .
21
25
RUN case ${TARGETPLATFORM} in \
22
26
"linux/amd64" ) ARCH=x64 ;; \
23
27
"linux/arm64" ) ARCH=arm64 ;; \
28
+ "linux/arm64/v8" ) ARCH=arm64 ;; \
24
29
"linux/arm/v7" ) ARCH=arm ;; \
25
30
esac \
26
31
&& dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore
You can’t perform that action at this time.
0 commit comments