This commit is contained in:
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ARG T_VERSION=1451
|
||||
ARG T_ZIP=terraria-server-${T_VERSION}.zip
|
||||
ARG T_URL=https://terraria.org/api/download/pc-dedicated-server/${T_ZIP}
|
||||
|
||||
# Tools needed to fetch + unpack the official server zip
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates wget unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /opt/terraria
|
||||
|
||||
# Download + extract
|
||||
RUN wget -O /tmp/terraria.zip "${T_URL}" \
|
||||
&& unzip /tmp/terraria.zip -d /opt/terraria \
|
||||
&& rm /tmp/terraria.zip \
|
||||
&& chmod +x "/opt/terraria/${T_VERSION}/Linux/TerrariaServer.bin.x86_64"
|
||||
|
||||
# Runtime dirs (mounted via volumes)
|
||||
RUN mkdir -p /config /worlds
|
||||
|
||||
# Optional: run as non-root (recommended)
|
||||
RUN useradd -m -u 1000 terraria \
|
||||
&& chown -R terraria:terraria /config /worlds /opt/terraria
|
||||
USER terraria
|
||||
|
||||
WORKDIR /opt/terraria/${T_VERSION}/Linux
|
||||
|
||||
EXPOSE 7777/tcp 7777/udp
|
||||
|
||||
COPY --chown=terraria:terraria entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user