File tree 1 file changed +3
-14
lines changed
1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change 8
8
# docker buildx build --platform "linux/arm64/v8" .
9
9
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build
10
10
ARG TARGETPLATFORM
11
+ ARG TARGETARCH
11
12
ARG BUILDPLATFORM
12
13
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
13
14
14
15
WORKDIR /source
15
16
COPY *.csproj .
16
- RUN case ${TARGETPLATFORM} in \
17
- "linux/amd64" ) ARCH=x64 ;; \
18
- "linux/arm64" ) ARCH=arm64 ;; \
19
- "linux/arm64/v8" ) ARCH=arm64 ;; \
20
- "linux/arm/v7" ) ARCH=arm ;; \
21
- esac \
22
- && dotnet restore -r linux-${ARCH}
17
+ RUN dotnet restore -a $TARGETARCH
23
18
24
19
COPY . .
25
- RUN case ${TARGETPLATFORM} in \
26
- "linux/amd64" ) ARCH=x64 ;; \
27
- "linux/arm64" ) ARCH=arm64 ;; \
28
- "linux/arm64/v8" ) ARCH=arm64 ;; \
29
- "linux/arm/v7" ) ARCH=arm ;; \
30
- esac \
31
- && dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore
20
+ RUN dotnet publish -c release -o /app -a $TARGETARCH --self-contained false --no-restore
32
21
33
22
# app image
34
23
FROM mcr.microsoft.com/dotnet/runtime:7.0
You can’t perform that action at this time.
0 commit comments