Dockerize TShock

This commit is contained in:
Joseph Goh 2022-10-23 04:09:57 +08:00
parent eba0ae1448
commit d85efbad60
No known key found for this signature in database
GPG key ID: 0C83392A0999DD5A
3 changed files with 57 additions and 0 deletions

15
.dockerignore Normal file
View file

@ -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/

41
Dockerfile Normal file
View file

@ -0,0 +1,41 @@
# Docker Instructions
# Build Image:
# docker build -t tshock .
# and run:
# docker run -p 7777:7777 -p 7878:7878 \
# -v <save path>:/tshock \
# -v <world path>:/worlds \
# -v <plugin path>:/plugins \
# --rm -it tshock -world /worlds/<world file> <flags>
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" \
]

View file

@ -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 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 support for Terraria 1.4.4.6, through OTAPI 3.1.5. (@SignatureBeef)
* Added GeoIP.dat back to the included list of files. (@SignatureBeef) * Added GeoIP.dat back to the included list of files. (@SignatureBeef)
* Dockerize TShock (@PotatoCider)
## TShock 4.5.18 ## TShock 4.5.18
* Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@PotatoCider) * Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@PotatoCider)