Skip to content

Commit

Permalink
fix: 🐛 Resolve issue with server startup
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Jun 13, 2024
1 parent 276571b commit 390747a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
23 changes: 11 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
FROM ubuntu:18.04

ENV USERNAME=steam
ENV MOD=cstrike

RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends curl file libc6:i386 lib32stdc++6 ca-certificates rsync && \
rm -rf /var/lib/apt/lists/*

RUN groupadd -r $USERNAME && \
useradd -r -g $USERNAME -m -d /opt/$USERNAME $USERNAME
RUN groupadd -r steam && \
useradd -r -g steam -m -d /opt/steam steam

RUN mkdir /config
USER $USERNAME
WORKDIR /opt/$USERNAME
USER steam
WORKDIR /opt/steam

COPY ./hlds.txt /opt/$USERNAME
COPY ./hlds.txt /opt/steam

RUN curl -v -sL media.steampowered.com/client/installer/steamcmd_linux.tar.gz | tar xzvf - && \
file /opt/$USERNAME/linux32/steamcmd && \
./steamcmd.sh +runscript hlds.txt +app_set_config 90 mod $MOD validate
file /opt/steam/linux32/steamcmd && \
./steamcmd.sh +force_install_dir ./hlds +runscript hlds.txt +app_set_config 90 mod $MOD validate

RUN mkdir -p $HOME/.steam \
&& ln -s /opt/$USERNAME/linux32 $HOME/.steam/sdk32 \
&& echo 70 > /opt/$USERNAME/hlds/steam_appid.txt
&& ln -s /opt/steam/linux32 $HOME/.steam/sdk32 \
&& echo 70 > /opt/steam/hlds/steam_appid.txt

WORKDIR /opt/$USERNAME/hlds
WORKDIR /opt/steam/hlds

COPY --chown=steam:steam config $MOD
COPY --chown=steam:steam ./entrypoint.sh ./entrypoint.sh
COPY --chown=steam:steam config $MOD

RUN chmod +x ./entrypoint.sh

Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ services:
hlds:
build: .
volumes:
- "./config:/tmp/config"
- "./config:/opt/steam/hlds/$MOD"
- "./config:/temp/config"
ports:
- "27015:27015/udp"
command: -game $MOD +maxplayers 12 +map cs_italy +rcon_password "replace_me" +log on
network_mode: "host"
command: -game ${MOD} +maxplayers 12 +map cs_italy +rcon_password "replace_me" +log on
environment:
MOD: "cstrike"
USERNAME: "steam"
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env sh

echo Starting Half-Life Dedicated Server...
if [ -d /tmp/hlds ]
then
rsync --chown=steam:steam /temp/hlds/* /opt/steam/hlds/$MOD
fi

echo Starting Half-Life Dedicated Server for

./hlds_run "$@"
1 change: 0 additions & 1 deletion hlds.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@ShutdownOnFailedCommand 0
@NoPromptForPassword 1
login anonymous
force_install_dir ./hlds
app_update 90
app_update 90 validate
app_update 90 validate
Expand Down

0 comments on commit 390747a

Please sign in to comment.