Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
techgarage-ir authored Sep 10, 2024
1 parent 0c015d6 commit 959e9e5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ WORKDIR /src

# Define platform
ARG TARGETPLATFORM
ARG RID

# Set the RID based on the TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
RID=linux-x64 ; \
echo "Setting RID for linux/amd64" ; RID=linux-x64 ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
RID=linux-arm64 ; \
fi
echo "Setting RID for linux/arm64" ; RID=linux-arm64 ; \
else \
echo "Unsupported platform $TARGETPLATFORM" ; exit 1 ; \
fi && \
echo "Using RID: $RID"

# Copy project files
COPY *.sln .
Expand Down Expand Up @@ -35,7 +41,7 @@ RUN dotnet publish "./UI/MTWireGuard.csproj" -c Release \
/p:PublishTrimmed=true

# Create final image and run project
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-noble-chiseled-extra AS final
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS final

ENV TZ=Asia/Tehran
WORKDIR /app
Expand Down

0 comments on commit 959e9e5

Please sign in to comment.