38 lines
906 B
Docker
38 lines
906 B
Docker
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
|