From 3411f3d0a9f68adde4355805435929c90ce56753 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Fri, 23 Apr 2021 15:16:51 +0200 Subject: [PATCH] Modernized TShock config --- firefly/docker-compose.yml | 2 +- tshock/.env.example | 32 ++++++++--------------------- tshock/Dockerfile | 42 +++++++++----------------------------- tshock/README.md | 20 ------------------ tshock/docker-compose.yml | 32 +++++++++-------------------- 5 files changed, 30 insertions(+), 98 deletions(-) diff --git a/firefly/docker-compose.yml b/firefly/docker-compose.yml index db2d902..7b16c61 100644 --- a/firefly/docker-compose.yml +++ b/firefly/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2.8' +version: '2.4' services: app: diff --git a/tshock/.env.example b/tshock/.env.example index fea30eb..0a562b3 100644 --- a/tshock/.env.example +++ b/tshock/.env.example @@ -1,29 +1,15 @@ -# Copyright (C) 2020 Jef Roosens - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -# Build arguments +# What version of TShock to use RELEASE_TAG= -# Environment variables +# What world size to create: +# 1 for small, 2 for medium, 3 for large AUTOCREATE=2 -# Mount points -CONFIG_DIR= -LOGS_DIR= -WORLDS_DIR= +# Mount points for the data directories +# By default, it creates volumes +CONFIG_DIR=config +LOGS_DIR=logs +WORLDS_DIR=worlds -# Other +# The port to publish the server on PORT=7777 diff --git a/tshock/Dockerfile b/tshock/Dockerfile index 2c694c1..c9f2d50 100644 --- a/tshock/Dockerfile +++ b/tshock/Dockerfile @@ -1,49 +1,27 @@ -# Copyright (C) 2020 Jef Roosens - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -FROM alpine:latest AS base +FROM alpine:3.13.5 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 +RUN apk update && apk add --no-cache unzip curl && \ + 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 -d tshock tshock.zip && \ + rm tshock.zip -FROM mono:latest +FROM mono:6.12.0.107 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 + ln -s /terraria/worlds /root/.local/share/Terraria/Worlds ENTRYPOINT \ mono /terraria/TerrariaServer.exe \ diff --git a/tshock/README.md b/tshock/README.md index 4351aa4..8cda9d8 100644 --- a/tshock/README.md +++ b/tshock/README.md @@ -1,23 +1,3 @@ - - - # Build arguments The only required build argument is `RELEASE_TAG`. This is the GitHub tag of the release you wish to use. The releases can be found diff --git a/tshock/docker-compose.yml b/tshock/docker-compose.yml index 31ad2a0..32181e7 100644 --- a/tshock/docker-compose.yml +++ b/tshock/docker-compose.yml @@ -1,37 +1,25 @@ -# Copyright (C) 2020 Jef Roosens - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -version: '3.5' +version: '2.4' services: - tshock: + app: build: context: . args: - 'RELEASE_TAG=${RELEASE_TAG}' - image: 'terraria-tshock:${RELEASE_TAG}' - - restart: 'unless-stopped' + image: 'chewingbever/terraria-tshock:${RELEASE_TAG}' + restart: 'always' stdin_open: true tty: true environment: - - AUTOCREATE + - 'AUTOCREATE' ports: - '$PORT:7777' volumes: - '$CONFIG_DIR:/terraria/config' - '$LOGS_DIR:/terraria/logs' - '$WORLDS_DIR:/terraria/worlds' + +volumes: + config: + logs: + worlds: