diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..002067b4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +# ignore every file +* + +# except for the ones required for building +!i18n/ +!prebuilts/ +!TerrariaServerAPI/ +!TShockAPI/ +!TShockLauncher/ +!TShockLauncher.Tests/ +!TShock.sln + +# but exclude build artifacts +*/bin/ +*/obj/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..00a6f3e2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ + +# Docker Instructions +# Build Image: +# docker build -t tshock . +# and run: +# docker run -p 7777:7777 -p 7878:7878 \ +# -v :/tshock \ +# -v :/worlds \ +# -v :/plugins \ +# --rm -it tshock -world /worlds/ + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS builder + +ARG ARCH=linux-x64 + +# Copy build context +WORKDIR /TShock +COPY . ./ + +# Build and package release +RUN dotnet build +WORKDIR /TShock/TShockLauncher +RUN dotnet publish -o output/ -r ${ARCH} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false + +# Runtime image +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runner +WORKDIR /server +COPY --from=builder /TShock/TShockLauncher/output ./ +RUN mkdir -p /tshock /worlds /plugins + +VOLUME ["/tshock", "/worlds", "/plugins"] +EXPOSE 7777 7878 + +ENTRYPOINT [ \ + "./TShock.Server", \ + "-configpath", "/tshock", \ + "-logpath", "/tshock/logs", \ + "-crashdir", "/tshock/crashes", \ + "-worldselectpath", "/worlds", \ + "-additionalplugins", "/plugins" \ +] \ No newline at end of file diff --git a/docs/changelog.md b/docs/changelog.md index 166645b3..7d277da5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -64,6 +64,7 @@ Use past tense when adding new entries; sign your name off when you add or chang * Added an internationalization system. The base for the i18n system was built by Janet Blackquill ([@pontaoski](https://github.com/pontaoski)). A small donation in her honor was made to the [KDE project](https://kde.org/) as a thankyou for this work. This also includes the `TSHOCK_LANGUAGE` environment variable. Setting `TSHOCK_LANGUAGE=tok` will enable a small number of [Toki Pona](https://tokipona.org/) translations as a proof-of-concept. (@pontaoski) * Added support for Terraria 1.4.4.6, through OTAPI 3.1.5. (@SignatureBeef) * Added GeoIP.dat back to the included list of files. (@SignatureBeef) +* Dockerize TShock (@PotatoCider) ## TShock 4.5.18 * Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@PotatoCider)