Initial commit

This commit is contained in:
John Edwards 2023-09-30 20:58:08 +01:00
parent 151d11e7c8
commit 0ccf90faac
6 changed files with 128 additions and 0 deletions

1
bullseye/.dockerignore Normal file
View file

@ -0,0 +1 @@
hooks/

53
bullseye/Dockerfile Normal file
View file

@ -0,0 +1,53 @@
###########################################################
# Dockerfile that builds a CS2 Gameserver
###########################################################
FROM cm2network/steamcmd:root as build_stage
LABEL maintainer="joedwards32@gmail.com"
ENV STEAMUSER "changeme"
ENV STEAMPASS "changeme"
ENV STEAMAPPID 730
ENV STEAMAPP cs2
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"
ENV CFG_URL https://raw.githubusercontent.com/joedwards32/CS2/settings.tgz
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
RUN set -x \
# Install, update & upgrade packages
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
wget \
ca-certificates \
lib32z1 \
&& mkdir -p "${STEAMAPPDIR}" \
# Add entry script
&& chmod +x "${HOMEDIR}/entry.sh" \
&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \
# Clean up
&& rm -rf /var/lib/apt/lists/*
FROM build_stage AS bullseye-base
ENV CS2_PORT=27015 \
CS2_MAXPLAYERS=10 \
CS2_RCONPW="changeme" \
CS2_PW="changeme" \
CS2_MAPGROUP="mg_active" \
CS2_STARTMAP="de_inferno" \
CS2_GAMETYPE=0 \
CS2_GAMEMODE=0 \
CS2_ADDITIONAL_ARGS=""
# Switch to user
USER ${USER}
WORKDIR ${HOMEDIR}
CMD ["bash", "entry.sh"]
# Expose ports
EXPOSE 27015/tcp \
27015/udp \
27020/udp

20
bullseye/etc/entry.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
mkdir -p "${STEAMAPPDIR}" || true
bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \
+login "${STEAMUSER}" "${STEAMPASS}" \
+app_update "${STEAMAPPID}" \
+quit
"${STEAMAPPDIR}/game/bin/linuxsteamrt64/cs2" -dedicated \
-usercon \
+game_type "${CS2_GAMETYPE}" \
+game_mode "${CS2_GAMEMODE}" \
+mapgroup "${CS2_MAPGROUP}" \
+map "${CS2_STARTMAP}" \
+sv_setsteamaccount \
-maxplayers_override "${CS2_MAXPLAYERS}" \
+rcon_password "${CS2_RCONPW}" \
+sv_password "${CS2_PW}" \
"${CS2_ADDITIONAL_ARGS}"

5
bullseye/hooks/build Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build --target=bullseye-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/..

2
bullseye/hooks/push Normal file
View file

@ -0,0 +1,2 @@
#!/bin/bash
docker push --all-tags ${DOCKER_REPO}