Skip to content

Commit

Permalink
Update cartservice Dockerfile for ARM64
Browse files Browse the repository at this point in the history
Use multiarch runtime-deps image, and configure the runtime identifier
based on the images architecture using uname -m.

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
  • Loading branch information
chancez committed Oct 13, 2022
1 parent 1539aca commit 6983866
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ WORKDIR /usr/src/app/
COPY ./src/cartservice/ ./
COPY ./pb/ ./src/protos/

RUN dotnet restore ./src/cartservice.csproj -r linux-musl-x64
RUN dotnet publish ./src/cartservice.csproj -p:PublishSingleFile=true -r linux-musl-x64 --self-contained true -p:PublishTrimmed=True -p:TrimMode=Link -c Release -o /cartservice --no-restore
RUN \
RUNTIME_IDENTIIFER=linux-musl-x64; \
if [ "$(uname -m)" = "aarch64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \
dotnet restore ./src/cartservice.csproj -r $RUNTIME_IDENTIIFER && \
dotnet publish ./src/cartservice.csproj -p:PublishSingleFile=true -r $RUNTIME_IDENTIIFER --self-contained true -p:PublishTrimmed=True -p:TrimMode=Link -c Release -o /cartservice --no-restore

# -----------------------------------------------------------------------------

# https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.5-alpine3.15-amd64
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.5-alpine3.15

WORKDIR /usr/src/app/
COPY --from=builder /cartservice/ ./
Expand Down

0 comments on commit 6983866

Please sign in to comment.