add Dockerfile

This commit is contained in:
Robin C. Ladiges 2022-06-28 04:53:43 +02:00
parent f9c20e73a8
commit ea1baee470
No known key found for this signature in database
GPG Key ID: B494D3DF92661B99
2 changed files with 46 additions and 1 deletions

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
################################################################################
################################################################## build ###
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
WORKDIR /app/
COPY ./Server/ ./Server/
COPY ./Shared/ ./Shared/
RUN dotnet publish ./Server/Server.csproj -c Release -o ./out/
################################################################## build ###
################################################################################
################################################################ runtime ###
FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime
WORKDIR /app/
RUN mkdir /data/ \
&& touch /data/settings.json \
&& ln -s /data/settings.json \
;
COPY --from=build /app/out/ ./
ENTRYPOINT [ "dotnet", "Server.dll" ]
EXPOSE 1027/tcp
VOLUME /data/
################################################################ runtime ###
################################################################################

View File

@ -4,6 +4,7 @@ The official server for the [Super Mario Odyssey: Online](https://github.com/Cra
## Windows Setup
1. Download latest build from [Releases](https://github.com/Sanae6/SmoOnlineServer/releases)
2. Run `Server.exe`
3. `settings.json` is autogenerated in step 2, modify it however you'd like.
@ -20,6 +21,16 @@ dotnet run --project Server/Server.csproj -c Release
```
If you ran `dotnet build` instead of `dotnet run`, you can find the binary at `Server/bin/net6.0/Release/Server.exe`
## Run docker image
If you have [docker](https://docs.docker.com/) on your system, you can use the existing docker image.
That way you don't have to build this server yourself or manually handle executables.
```shell
docker run --rm -it -p 1027:1027 -v smoo-data:/data/ ghcr.io/sanae6/smo-online-server
```
To always check for and use the latest server version you can add `--pull=always` to the options.
## Commands
@ -27,4 +38,4 @@ Run `help` to get what commands are available in the server console.
Run the `loadsettings` command in the console to update the settings without restarting.
Server address and port will require a server restart, but everything else should update when you run `loadsettings`.
[//]: # (TODO: Document all commands, possibly rename them too.)
[//]: # (TODO: Document all commands, possibly rename them too.)