Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run as Steam User #70

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
--env=SERVER_NAME="GitHubActionTest" \
--env=SERVER_PASSWORD="github_action_test_password" \
--env=UDP_PORT="25499" \
--env=CPU_MHZ="1000" \
docker.io/renegademaster/zomboid-dedicated-server:${{ steps.variables.outputs.datetime }} \
2>&1 | tee ./docker-log.log

Expand Down Expand Up @@ -184,6 +185,7 @@ jobs:
--env=SERVER_NAME="GitHubActionTest" \
--env=SERVER_PASSWORD="github_action_test_password" \
--env=UDP_PORT="25499" \
--env=CPU_MHZ="1000" \
docker.io/renegademaster/zomboid-dedicated-server:${{ steps.variables.outputs.datetime }} \
2>&1 | tee ./docker-log.log

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ services:
- "UDP_PORT=16262"
- "USE_STEAM=true"
- "TZ=UTC"
- "CPU_MHZ=1000"
ports:
- target: 16261
published: 16261
Expand Down
34 changes: 30 additions & 4 deletions docker/zomboid-dedicated-server.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,50 @@
#######################################################################

# Base Image
ARG BASE_IMAGE="docker.io/renegademaster/steamcmd-minimal:1.1.2"
ARG BASE_IMAGE="docker.io/renegademaster/steamcmd-minimal:2.0.0-root"
ARG UID=1000
ARG GID=${UID}
ARG RUN_USER=steam

FROM ${BASE_IMAGE}
ARG UID
ARG GID
ARG RUN_USER

USER 0:0

# Add metadata labels
LABEL com.renegademaster.zomboid-dedicated-server.authors="Renegade-Master" \
com.renegademaster.zomboid-dedicated-server.contributors="JohnEarle, ramielrowe" \
com.renegademaster.zomboid-dedicated-server.source-repository="https://github.com/Renegade-Master/zomboid-dedicated-server" \
com.renegademaster.zomboid-dedicated-server.image-repository="https://hub.docker.com/renegademaster/zomboid-dedicated-server"

# Copy the source files
COPY src /home/steam/

# Install Python, and take ownership of rcon binary
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-minimal iputils-ping tzdata \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*


# Setup runtime user
RUN groupadd "${RUN_USER}" \
--gid "${GID}" \
&& useradd "${RUN_USER}" --create-home \
--uid "${UID}" \
--gid "${GID}" \
--home-dir /home/${RUN_USER} \
&& chown -R ${UID}:${GID} /home/${RUN_USER}/

# Login as the runtime user
USER ${RUN_USER}

# Copy the source files
COPY --chown=${RUN_USER} src /home/steam/
COPY --chown=${RUN_USER} --from="docker.io/renegademaster/steamcmd-minimal:2.0.0-root" /home/root/.local/steamcmd /home/steam/.local/steamcmd

# ENV
ENV STEAMDIR=/home/steam/.local/steamcmd
ENV PATH=/home/steam/.local/steamcmd:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Run the setup script
ENTRYPOINT ["/bin/bash", "/home/steam/run_server.sh"]