SmoOnlineServer/Dockerfile

46 lines
1.3 KiB
Docker
Raw Normal View History

2022-06-28 02:53:43 +00:00
################################################################################
################################################################## build ###
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0 as build
2022-06-28 02:53:43 +00:00
WORKDIR /app/
COPY ./Server/ ./Server/
COPY ./Shared/ ./Shared/
ARG TARGETARCH
# Download NuGet dependencies
RUN dotnet restore \
./Server/Server.csproj \
-r debian.11-`echo $TARGETARCH | sed 's@^amd@x@'` \
;
# Build application binary
RUN dotnet publish \
./Server/Server.csproj \
-r debian.11-`echo $TARGETARCH | sed 's@^amd@x@'` \
-c Release \
-o ./out/ \
--no-restore \
--self-contained \
-p:publishSingleFile=true \
;
2022-06-28 02:53:43 +00:00
################################################################## build ###
################################################################################
################################################################ runtime ###
2022-07-03 17:35:31 +00:00
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
2022-06-28 02:53:43 +00:00
# Copy application binary from build stage
2022-07-02 17:13:47 +00:00
COPY --from=build /app/out/ /app/
2022-06-28 02:53:43 +00:00
ENTRYPOINT [ "/app/Server" ]
EXPOSE 1027/tcp
WORKDIR /data/
VOLUME /data/
2022-06-28 02:53:43 +00:00
################################################################ runtime ###
################################################################################