0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-21 18:55:17 +00:00
SmoOnlineServer/Dockerfile
Robin C. Ladiges ccccdecb6a
Provide docker image (#6)
* add Dockerfile

* add docker-compose.yml

* Github workflow to build and deploy docker image

* workdir /data/ instead of /app/

* use a local directory instead of a named volume

This makes the settings.json more accessible from the outside by
default, but is less portable.

The -v command with $PWD might not work on native Windows shells, but
rather wants an absolute Windows path like C:\User\... or /c/User/...

And on Linux, because the /data/ directory and the settings.json will be
owned by root. Though that can be changed.

* more docker-compose command examples

* add linux/arm/v7 ; improve build & runtime

* fix: just arm not arm32

* test docker build for PRs

* back to the microsoft runtime
2022-07-17 13:00:31 -06:00

45 lines
1.3 KiB
Docker

################################################################################
################################################################## build ###
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0 as build
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 \
;
################################################################## build ###
################################################################################
################################################################ runtime ###
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
# Copy application binary from build stage
COPY --from=build /app/out/ /app/
ENTRYPOINT [ "/app/Server" ]
EXPOSE 1027/tcp
WORKDIR /data/
VOLUME /data/
################################################################ runtime ###
################################################################################