diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7f84c5e --- /dev/null +++ b/Dockerfile @@ -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 ### +################################################################################ diff --git a/README.md b/README.md index 054fc0f..1b6a1d0 100644 --- a/README.md +++ b/README.md @@ -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.) \ No newline at end of file +[//]: # (TODO: Document all commands, possibly rename them too.)