Skip to content

Commit

Permalink
Updated Dockerfile to work with mainline engine
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Oct 6, 2024
1 parent 543f8ec commit 67c1bd8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 57 deletions.
72 changes: 23 additions & 49 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,77 +1,52 @@
FROM debian:buster-slim
FROM debian:bookworm-slim

ARG hlds_build=8308
ARG amxmod_version=1.8.2
ARG jk_botti_version=1.43
ARG steamcmd_url=https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
ARG hlds_url="https://github.com/DevilBoy-eXe/hlds/releases/download/$hlds_build/hlds_build_$hlds_build.zip"
ARG metamod_url="https://github.com/mittorn/metamod-p/releases/download/1/metamod.so"
ARG amxmod_url="http://www.amxmodx.org/release/amxmodx-$amxmod_version-base-linux.tar.gz"
ARG jk_botti_url="http://koti.kapsi.fi/jukivili/web/jk_botti/jk_botti-$jk_botti_version-release.tar.xz"

ENV XASH3D_BASEDIR=/opt/steam/xashds

# Fix warning:
# WARNING: setlocale('en_US.UTF-8') failed, using locale: 'C'.
# International characters may not work.
RUN apt-get update && apt-get install -y --no-install-recommends \
locales=2.28-10 \
&& rm -rf /var/lib/apt/lists/* \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8
ENV LC_ALL en_US.UTF-8

# Fix error:
# Unable to determine CPU Frequency. Try defining CPU_MHZ.
# Exiting on SPEW_ABORT
ENV CPU_MHZ=2300

RUN groupadd -r steam && useradd -r -g steam -m -d /opt/steam steam
RUN usermod -a -G games steam

RUN dpkg --add-architecture i386
RUN apt-get -y update && apt-get install -y --no-install-recommends \
build-essential=12.6 \
ca-certificates=20190110 \
cmake=3.13.4-1 \
curl=7.64.0-4+deb10u1 \
git=1:2.20.1-2+deb10u3 \
gnupg2=2.2.12-1+deb10u1 \
g++-multilib=4:8.3.0-1 \
lib32gcc1=1:8.3.0-6 \
libstdc++6:i386=8.3.0-6 \
python=2.7.16-1 \
unzip=6.0-23+deb10u1 \
xz-utils=5.2.4-1 \
zip=3.0-11+b1 \
build-essential \
ca-certificates \
curl \
git \
gnupg2 \
g++-multilib \
lib32gcc-s1 \
libstdc++6 \
python3 \
unzip \
xz-utils \
zip \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*

RUN git clone --recursive https://github.com/FWGS/xash3d \
&& mkdir -p xash3d/build
WORKDIR /xash3d/build
RUN cmake -DXASH_DEDICATED=ON -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" ../ \
&& make \
&& make install \
&& mv engine/xash3d /usr/local/bin/xashds \
&& rm -rf /xash3d

USER steam
WORKDIR /opt/steam
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./lib/hlds.install /opt/steam

RUN curl -sL "$steamcmd_url" | tar xzvf - \
&& ./steamcmd.sh +runscript hlds.install
RUN mkdir -p /opt/steam/xashds

RUN curl -sLJO "$hlds_url" \
&& unzip "hlds_build_$hlds_build.zip" -d "/opt/steam/hlds_build_$hlds_build" \
&& cp -R "hlds_build_$hlds_build/hlds"/* xashds/ \
&& rm -rf "hlds_build_$hlds_build" "hlds_build_$hlds_build.zip"

# Fix error that steamclient.so is missing
RUN mkdir -p "$HOME/.steam" \
&& ln -s /opt/steam/linux32 "$HOME/.steam/sdk32"
RUN git clone --recursive https://github.com/FWGS/xash3d-fwgs \
&& cd xash3d-fwgs \
&& ARCH=i386 ./waf configure -T release -d --enable-lto \
&& ./waf build \
&& ./waf install --destdir /opt/steam/xashds \
&& cd .. && rm -rf xash3d-fwgs

# Fix warnings:
# couldn't exec listip.cfg
Expand All @@ -95,8 +70,7 @@ RUN curl -sqL "$jk_botti_url" | tar -C /opt/steam/xashds/valve/ -xJ \
&& echo 'linux addons/jk_botti/dlls/jk_botti_mm_i386.so' >> /opt/steam/xashds/valve/addons/metamod/plugins.ini

WORKDIR /opt/steam/xashds

RUN mv cstrike/liblist.gam cstrike/gameinfo.txt
RUN rm -rf ./cstrike
RUN mv valve/liblist.gam valve/gameinfo.txt

# Copy default config
Expand All @@ -106,7 +80,7 @@ EXPOSE 27015
EXPOSE 27015/udp

# Start server
ENTRYPOINT ["xashds"]
ENTRYPOINT ["./xash"]

# Default start parameters
CMD ["+ip 0.0.0.0", "-timeout 3", "-pingboost 1", "+rcon_password 12345678"]
CMD ["+ip 0.0.0.0", "+rcon_password 12345678"]
8 changes: 0 additions & 8 deletions lib/hlds.install

This file was deleted.

0 comments on commit 67c1bd8

Please sign in to comment.