Added tshock server; moved env vars to .env file

pull/3/head
Jef Roosens 2020-12-30 15:13:22 +01:00
parent fa44bd7b0c
commit ed0f06e797
9 changed files with 72 additions and 6 deletions

View File

@ -1 +1,3 @@
FABRIC_VERSION=
XMS=4
XMX=4

View File

@ -12,8 +12,8 @@ services:
tty: true
environment:
- XMS=4
- XMX=4
- XMS
- XMX
ports:
- '25565:25565'
volumes:

View File

@ -1,2 +1,4 @@
MC_VERSION=
FORGE_VERSION=
XMS=4
XMX=4

View File

@ -13,8 +13,8 @@ services:
tty: true
environment:
- XMS=4
- XMX=4
- XMS
- XMX
ports:
- '25565:25565'
volumes:

View File

@ -1,2 +1,4 @@
MC_VERSION=
PAPERMC_VERSION=
XMS=4
XMX=4

View File

@ -14,8 +14,8 @@ services:
tty: true
environment:
- XMS=4
- XMX=4
- XMS
- XMX
ports:
- '25565:25565'
volumes:

View File

@ -0,0 +1,2 @@
RELEASE_TAG=
AUTOCREATE=2

37
tshock/Dockerfile 100644
View File

@ -0,0 +1,37 @@
FROM alpine:latest AS base
# Build arguments
ARG RELEASE_TAG
# Add unzip & curl
RUN apk update && apk add --no-cache unzip curl
WORKDIR /terraria
# Download & unzip
# TODO convert this to jq?
RUN curl -s "https://api.github.com/repos/Pryaxis/TShock/releases/tags/${RELEASE_TAG}" | \
grep "browser_download_url" | \
grep -o "https[^\"]\+" | \
xargs curl -sLo tshock.zip && \
unzip tshock.zip && \
rm tshock.zip && \
# Is there a better way to do this?
mv TShock* tshock
FROM mono:latest
WORKDIR /terraria
COPY --from=base /terraria/tshock /terraria
# Create worlds directory & symlink it
RUN mkdir -p worlds logs config /root/.local/share/Terraria && \
ln -s /terraria/worlds /root/.local/share/Terraria/Worlds
ENTRYPOINT \
mono /terraria/TerrariaServer.exe \
-configpath /terraria/config \
-logpath /terraria/logs \
-autocreate "$AUTOCREATE" \
-world /terraria/worlds/Main.wld

View File

@ -0,0 +1,21 @@
version: '3.5'
services:
tshock:
build:
context: .
args:
- 'RELEASE_TAG=${RELEASE_TAG}'
image: 'terraria-tshock:${RELEASE_TAG}'
restart: 'unless-stopped'
stdin_open: true
tty: true
environment:
- AUTOCREATE
ports:
- '7777:7777'
volumes:
- '/data/tshock/config:/terraria/config'
- '/data/tshock/logs:/terraria/logs'
- '/data/tshock/worlds:/terraria/worlds'