diff --git a/src/cartservice/src/Dockerfile b/src/cartservice/src/Dockerfile index 37205b27d9..7b7d534311 100644 --- a/src/cartservice/src/Dockerfile +++ b/src/cartservice/src/Dockerfile @@ -15,7 +15,8 @@ # limitations under the License. # https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM mcr.microsoft.com/dotnet/sdk:8.0.100-1 AS builder +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.100-1 AS builder +ARG TARGETARCH WORKDIR /usr/src/app/ @@ -24,12 +25,12 @@ COPY ./pb/ ./src/protos/ RUN \ RUNTIME_IDENTIIFER=linux-musl-x64; \ - if [ "$(uname -m)" = "aarch64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ + if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ dotnet restore ./src/cartservice.csproj -v d -r $RUNTIME_IDENTIIFER RUN \ RUNTIME_IDENTIIFER=linux-musl-x64; \ - if [ "$(uname -m)" = "aarch64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ + if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ dotnet publish ./src/cartservice.csproj -v d -p:PublishSingleFile=true -r $RUNTIME_IDENTIIFER --self-contained true -p:PublishTrimmed=False -p:TrimMode=Link -c Release -o /cartservice --no-restore # -----------------------------------------------------------------------------