added Dockerfile and Compose (currently does not work)

This commit is contained in:
bacalhau 2025-11-02 18:15:45 +00:00
parent a854df6845
commit 2084cfdf92
4 changed files with 88 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
data

70
Dockerfile Normal file
View file

@ -0,0 +1,70 @@
############################################################
# Dockerfile that contains SteamCMD
############################################################
FROM debian:bookworm-slim as build_stage
LABEL maintainer="admin@based.pt"
ARG PUID=1000
ENV USER steam
ENV HOMEDIR "/home/${USER}"
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
RUN set -x \
# Install, update & upgrade packages
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
lib32stdc++6=12.2.0-14+deb12u1 \
lib32gcc-s1=12.2.0-14+deb12u1 \
ca-certificates=20230311+deb12u1 \
nano=7.2-1+deb12u1 \
curl=7.88.1-10+deb12u14 \
locales=2.36-9+deb12u13 \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
# Create unprivileged user
&& useradd -u "${PUID}" -m "${USER}" \
# Download SteamCMD, execute as user
&& su "${USER}" -c \
"mkdir -p \"${STEAMCMDDIR}\" \
&& curl -fsSL 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar xvzf - -C \"${STEAMCMDDIR}\" \
&& \"./${STEAMCMDDIR}/steamcmd.sh\" +quit \
&& ln -s \"${STEAMCMDDIR}/linux32/steamclient.so\" \"${STEAMCMDDIR}/steamservice.so\" \
&& mkdir -p \"${HOMEDIR}/.steam/sdk32\" \
&& ln -s \"${STEAMCMDDIR}/linux32/steamclient.so\" \"${HOMEDIR}/.steam/sdk32/steamclient.so\" \
&& ln -s \"${STEAMCMDDIR}/linux32/steamcmd\" \"${STEAMCMDDIR}/linux32/steam\" \
&& mkdir -p \"${HOMEDIR}/.steam/sdk64\" \
&& ln -s \"${STEAMCMDDIR}/linux64/steamclient.so\" \"${HOMEDIR}/.steam/sdk64/steamclient.so\" \
&& ln -s \"${STEAMCMDDIR}/linux64/steamcmd\" \"${STEAMCMDDIR}/linux64/steam\" \
&& ln -s \"${STEAMCMDDIR}/steamcmd.sh\" \"${STEAMCMDDIR}/steam.sh\"" \
# Symlink steamclient.so; So misconfigured dedicated servers can find it
&& ln -s "${STEAMCMDDIR}/linux64/steamclient.so" "/usr/lib/x86_64-linux-gnu/steamclient.so" \
&& rm -rf /var/lib/apt/lists/*
FROM build_stage AS steamcmd
###########################################################
# HALF-LIFE SERVER
##########################################################
FROM steamcmd AS hlds
# Define variables
ENV STEAMAPPID 90
ENV STEAMAPPDIR "data/hlds"
ENV PORT 27015
USER ${USER}
WORKDIR ${HOMEDIR}
# Install Half-Life Dedicated Server (HLDS) for Counter-Strike
RUN mkdir -p ${STEAMAPPDIR} \
&& ${STEAMCMDDIR}/steamcmd.sh +force_install_dir ${STEAMAPPDIR} +login anonymous +app_update 90 +quit
# Expose necessary ports for the game
EXPOSE ${PORT}
# Run HLDS with the Counter-Strike mod
ENTRYPOINT ["${STEAMAPPDIR}/hlds_run", "-game", "cstrike", "-console", "-port", "${PORT}", "-steam_dir", "${STEAMCMDDIR}", "-steamcmd_script", "${STEAMCMDDIR}/steamcmd.sh"]

View file

@ -1,2 +1,7 @@
# cs1.6 server container
very minimal cs1.6 server container, should work with reHLDS and all that...
## how to use
Download the repo, and start the compose!!!!!

12
docker-compose.yml Normal file
View file

@ -0,0 +1,12 @@
version: '3.8'
services:
counter-strike:
build: .
container_name: counter-strike
ports:
- "27016:27015/udp"
volumes:
- ./data:/data
restart: always