From 58683fc34702b47590f396a709424b337e1e4ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 8 Dec 2023 12:37:10 +0100 Subject: [PATCH] Use BUILDPLATFORM/TARGETARCH --- src/cartservice/src/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 # -----------------------------------------------------------------------------