From ed0f06e7977c724262e97651f73927c26c08e90e Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 30 Dec 2020 15:13:22 +0100 Subject: [PATCH] Added tshock server; moved env vars to .env file --- fabric/.env.example | 2 ++ fabric/docker-compose.yml | 4 ++-- forge/.env.example | 2 ++ forge/docker-compose.yml | 4 ++-- papermc/.env.example | 2 ++ papermc/docker-compose.yml | 4 ++-- tshock/.env.example | 2 ++ tshock/Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ tshock/docker-compose.yml | 21 +++++++++++++++++++++ 9 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 tshock/.env.example create mode 100644 tshock/Dockerfile create mode 100644 tshock/docker-compose.yml diff --git a/fabric/.env.example b/fabric/.env.example index 45b64ca..adb6a6e 100644 --- a/fabric/.env.example +++ b/fabric/.env.example @@ -1 +1,3 @@ FABRIC_VERSION= +XMS=4 +XMX=4 diff --git a/fabric/docker-compose.yml b/fabric/docker-compose.yml index 96af608..8b19865 100644 --- a/fabric/docker-compose.yml +++ b/fabric/docker-compose.yml @@ -12,8 +12,8 @@ services: tty: true environment: - - XMS=4 - - XMX=4 + - XMS + - XMX ports: - '25565:25565' volumes: diff --git a/forge/.env.example b/forge/.env.example index 3a4e4fc..23408f3 100644 --- a/forge/.env.example +++ b/forge/.env.example @@ -1,2 +1,4 @@ MC_VERSION= FORGE_VERSION= +XMS=4 +XMX=4 diff --git a/forge/docker-compose.yml b/forge/docker-compose.yml index a6c7555..b618745 100644 --- a/forge/docker-compose.yml +++ b/forge/docker-compose.yml @@ -13,8 +13,8 @@ services: tty: true environment: - - XMS=4 - - XMX=4 + - XMS + - XMX ports: - '25565:25565' volumes: diff --git a/papermc/.env.example b/papermc/.env.example index c70b392..b2b60be 100644 --- a/papermc/.env.example +++ b/papermc/.env.example @@ -1,2 +1,4 @@ MC_VERSION= PAPERMC_VERSION= +XMS=4 +XMX=4 diff --git a/papermc/docker-compose.yml b/papermc/docker-compose.yml index 535496f..437ba79 100644 --- a/papermc/docker-compose.yml +++ b/papermc/docker-compose.yml @@ -14,8 +14,8 @@ services: tty: true environment: - - XMS=4 - - XMX=4 + - XMS + - XMX ports: - '25565:25565' volumes: diff --git a/tshock/.env.example b/tshock/.env.example new file mode 100644 index 0000000..5a2f2af --- /dev/null +++ b/tshock/.env.example @@ -0,0 +1,2 @@ +RELEASE_TAG= +AUTOCREATE=2 diff --git a/tshock/Dockerfile b/tshock/Dockerfile new file mode 100644 index 0000000..d5369eb --- /dev/null +++ b/tshock/Dockerfile @@ -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 diff --git a/tshock/docker-compose.yml b/tshock/docker-compose.yml new file mode 100644 index 0000000..3129f7b --- /dev/null +++ b/tshock/docker-compose.yml @@ -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'