forked from LunaMultiplayer/LunaMultiplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_Server
61 lines (51 loc) · 2.49 KB
/
Dockerfile_Server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#Build this image with: docker build --file Dockerfile_Server -t lmpsrv:latest .
#Delete the image with the command: docker image rm lmpsrv:latest
#Create a container with: docker run -td -p 8800:8800 -p 8900:8900 --name lmpsrv lmpsrv:latest
# the -t (tty) flag is needed so docker can send SIGINT for proper shutdown.
#Attach to a container with: docker exec -it lmpsrv /bin/ash
#When inside a container, you can dettach with: CONTROL+P+Q
#Check logs with: docker logs -f lmpsrv
#Stop a container with: docker stop lmpsrv
#Start a container with: docker start lmpsrv
#Remove a container with: docker container rm lmpsrv
ARG OS_BASE=alpine
ARG OS_VERSION=3.17
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0-${OS_BASE}${OS_VERSION} as base
COPY .nuget /LunaMultiplayer/.nuget
COPY LmpCommon/LmpCommon.shproj /LunaMultiplayer/LmpCommon/LmpCommon.shproj
COPY Lidgren/Lidgren.shproj /LunaMultiplayer/Lidgren/Lidgren.shproj
COPY LmpGlobal/LmpGlobal.shproj /LunaMultiplayer/LmpGlobal/LmpGlobal.shproj
COPY Lidgren.Core/Lidgren.Core.csproj /LunaMultiplayer/Lidgren.Core/Lidgren.Core.csproj
COPY Lidgren.Net/Lidgren.Net.csproj /LunaMultiplayer/Lidgren.Net/Lidgren.Net.csproj
COPY uhttpsharp/uhttpsharp.csproj /LunaMultiplayer/uhttpsharp/uhttpsharp.csproj
COPY LmpUpdater/LmpUpdater.csproj /LunaMultiplayer/LmpUpdater/LmpUpdater.csproj
COPY Server/Server.csproj /LunaMultiplayer/Server/Server.csproj
ARG OS_BASE
ARG OS_VERSION
ARG TARGETARCH
ARG TARGETVARIANT
RUN export TARGET=$(echo ${TARGETARCH}${TARGETVARIANT} | sed -e 's/amd64/x64/' -e 's/armv8/arm64/' -e 's/armv7/arm/'); \
cd /LunaMultiplayer/Server && \
dotnet restore -r ${OS_BASE}.${OS_VERSION}-${TARGET}
COPY . /LunaMultiplayer
FROM base as debug
WORKDIR /LunaMultiplayer/Server
ENV DOTNET_PerfMapEnabled=1
ENV COMPlus_PerfMapEnabled=1
CMD [ "/bin/ash" ]
FROM --platform=$BUILDPLATFORM base as builder
WORKDIR /LunaMultiplayer/Server
ARG OS_BASE
ARG OS_VERSION
ARG TARGETARCH
ARG TARGETVARIANT
RUN export TARGET=$(echo ${TARGETARCH}${TARGETVARIANT} | sed -e 's/amd64/x64/' -e 's/armv8/arm64/' -e 's/armv7/arm/'); \
dotnet publish -c Release -r ${OS_BASE}.${OS_VERSION}-${TARGET} -o Publish
FROM ${OS_BASE}:${OS_VERSION}
RUN apk add icu-libs libstdc++ libgcc
COPY --from=builder /LunaMultiplayer/Server/Publish/ /LMPServer/
EXPOSE 8800/udp 8900/tcp
VOLUME "/LMPServer/Config" "/LMPServer/Plugins" "/LMPServer/Universe" "/LMPServer/logs"
STOPSIGNAL SIGINT
WORKDIR /LMPServer
CMD ./Server