Added tshock server; moved env vars to .env file
This commit is contained in:
parent
fa44bd7b0c
commit
ed0f06e797
9 changed files with 72 additions and 6 deletions
2
tshock/.env.example
Normal file
2
tshock/.env.example
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
RELEASE_TAG=
|
||||
AUTOCREATE=2
|
||||
37
tshock/Dockerfile
Normal file
37
tshock/Dockerfile
Normal 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
|
||||
21
tshock/docker-compose.yml
Normal file
21
tshock/docker-compose.yml
Normal 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'
|
||||
Reference in a new issue