Skip to content

Commit

Permalink
feat: use custom base image
Browse files Browse the repository at this point in the history
  • Loading branch information
RouHim committed Feb 28, 2024
1 parent 62a7a4c commit 3a20ca4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 118 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ When starting the server for the first time:

* The config files and folders will be automatically created in the `config/` folder.
* The server will download the latest version of the game from Steam to the `data/` folder.
* The server might need to be restarted once to apply the latest game update.

> You have to restart after the first start.
To restart the server after making changes to the configuration, use the following command:

Expand Down
55 changes: 4 additions & 51 deletions container-data/Containerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
# Use latest Ubuntu as base image
FROM ubuntu:devel
FROM rouhim/steamcmd-wine:latest

# Define environment variables
ENV USER_HOME "/home/ubuntu"
ENV STEAMCMD "$USER_HOME/steamcmd/steamcmd.sh"
ENV SERVER_DIR "/data"
ENV SERVER_CONFIG_DIR "/config"
ENV STEAM_APP_ID "2465200"
ENV STARTUP_COMMAND "wine SonsOfTheForestDS.exe -userdatapath $SERVER_CONFIG_DIR"

# Use default non root user ubuntu (1000)
WORKDIR $USER_HOME

# Install steamcmd and its dependencies
RUN apt update && \
apt install -y wget ca-certificates lib32gcc-s1 && \
mkdir -p $USER_HOME/steamcmd && \
wget -qO- 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar zxf - -C $USER_HOME/steamcmd && \
chown -R ubuntu:ubuntu $USER_HOME/steamcmd

# Install wine and its dependencies and do a full system upgrade to get the latest and greatest packages
RUN apt update && \
apt install -y --no-install-recommends wine wine64 winbind xvfb && \
apt upgrade -y

# Cleanup, remove wget
RUN apt remove -y wget && \
apt clean && \
rm -rf /var/lib/apt/lists

# Create game server and config directory
RUN mkdir -p $SERVER_DIR $SERVER_CONFIG_DIR
VOLUME $SERVER_DIR
VOLUME $SERVER_CONFIG_DIR

# Copy steam-game.script to container
COPY steam-game.script $USER_HOME/steam-game.script

# Change user to non-root user
RUN chown -R ubuntu:ubuntu $USER_HOME && \
chown -R nobody:nogroup $SERVER_DIR $SERVER_CONFIG_DIR && \
chmod 777 -R $SERVER_DIR $SERVER_CONFIG_DIR
USER ubuntu

# Game port
EXPOSE 8766/udp
# Query port
EXPOSE 27016/udp
# Blobsync port
EXPOSE 9700/udp

# Define entrypoint
COPY --chown=ubuntu:ubuntu --chmod=755 entrypoint.sh /sons-of-the-forest-server.sh
ENTRYPOINT ["/sons-of-the-forest-server.sh"]
COPY pre.sh $USER_HOME/pre.sh
57 changes: 0 additions & 57 deletions container-data/entrypoint.sh

This file was deleted.

6 changes: 6 additions & 0 deletions container-data/pre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh


# Set skip network accessibility test to true
echo "🔧 Adjust server config..."
sed -i 's/"SkipNetworkAccessibilityTest": false/"SkipNetworkAccessibilityTest": true/g' "$SERVER_CONFIG_DIR"/dedicatedserver.cfg
9 changes: 0 additions & 9 deletions container-data/steam-game.script

This file was deleted.

0 comments on commit 3a20ca4

Please sign in to comment.