diff --git a/Docker/build_dotnet.sh b/Docker/build_dotnet.sh index 37c18c99d..cd8b4b2a6 100644 --- a/Docker/build_dotnet.sh +++ b/Docker/build_dotnet.sh @@ -1,13 +1,11 @@ #!/bin/bash ARCH=$(uname -m) - -echo "UNAME IS!!!!: $ARCH" - -if [ $ARCH == "armv7l" ]; then +echo "TARGET PLATFORM: $TARGETPLATFORM" +if [ $TARGETPLATFORM == "linux/arm/v7" ]; then dotnet publish /usr/src/Service/Service.csproj -v q -c Release -r "linux-arm" -o "/daemon" -elif [ $ARCH == "aarch64" ]; then - dotnet publish /usr/src/Service/Service.csproj -v q -c Release -r "linux-arm" -o "/daemon" -elif [ $ARCH == "x86_64" ]; then +elif [ $TARGETPLATFORM == "linux/arm64" ]; then + dotnet publish /usr/src/Service/Service.csproj -v q -c Release -r "linux-arm64" -o "/daemon" +elif [ $TARGETPLATFORM == "linux/amd64" ]; then dotnet publish /usr/src/Service/Service.csproj -v q -c Release -r "linux-x64" -o "/daemon" else echo 'NOT VALID BUILD'; exit 1; diff --git a/Dockerfile b/Dockerfile index 637560724..481afa164 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,6 @@ # Build the NetDaemon Admin with build container FROM ludeeus/container:frontend as builder -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -RUN echo "I am running on $BUILDPLATFORM" > /log -RUN echo "building for $TARGETPLATFORM" > /log - - RUN \ apk add make \ \ @@ -22,6 +15,13 @@ RUN \ # Pre-build .NET NetDaemon core project FROM mcr.microsoft.com/dotnet/sdk:5.0.101-buster-slim-amd64 as netbuilder +ARG TARGETPLATFORM +ARG BUILDPLATFORM + +RUN echo "I am running on $BUILDPLATFORM" +RUN echo "building for $TARGETPLATFORM" + +RUN export TARGETPLATFORM=$TARGETPLATFORM # Copy the source to docker container COPY ./src /usr/src COPY ./Docker/build_dotnet.sh /build.sh