Migrate from bullseye to bookworm
* Pin bookworm explicitly in parent container image tags * Update references to bullseye
This commit is contained in:
parent
78009c6396
commit
573abc9a49
11 changed files with 9 additions and 9 deletions
1
bookworm/.dockerignore
Normal file
1
bookworm/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
hooks/
|
90
bookworm/Dockerfile
Normal file
90
bookworm/Dockerfile
Normal file
|
@ -0,0 +1,90 @@
|
|||
###########################################################
|
||||
# Dockerfile that builds a CS2 Gameserver
|
||||
###########################################################
|
||||
|
||||
# BUILD STAGE
|
||||
|
||||
FROM cm2network/steamcmd:root-bookworm as build_stage
|
||||
|
||||
LABEL maintainer="joedwards32@gmail.com"
|
||||
|
||||
ENV STEAMAPPID 730
|
||||
ENV STEAMAPP cs2
|
||||
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"
|
||||
ENV STEAMAPPVALIDATE 0
|
||||
|
||||
COPY etc/entry.sh "${HOMEDIR}/entry.sh"
|
||||
COPY etc/server.cfg "/etc/server.cfg"
|
||||
COPY etc/pre.sh "/etc/pre.sh"
|
||||
COPY etc/post.sh "/etc/post.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 \
|
||||
simpleproxy \
|
||||
libicu-dev \
|
||||
unzip \
|
||||
jq \
|
||||
&& mkdir -p "${STEAMAPPDIR}" \
|
||||
# Add entry script
|
||||
&& chmod +x "${HOMEDIR}/entry.sh" \
|
||||
&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \
|
||||
# Clean up
|
||||
&& apt-get clean \
|
||||
&& find /var/lib/apt/lists/ -type f -delete
|
||||
|
||||
# BASE
|
||||
|
||||
FROM build_stage AS bookworm-base
|
||||
|
||||
ENV CS2_SERVERNAME="cs2 private server" \
|
||||
CS2_CHEATS=0 \
|
||||
CS2_IP=0.0.0.0 \
|
||||
CS2_SERVER_HIBERNATE=0 \
|
||||
CS2_PORT=27015 \
|
||||
CS2_RCON_PORT="" \
|
||||
CS2_MAXPLAYERS=10 \
|
||||
CS2_RCONPW="changeme" \
|
||||
CS2_PW="changeme" \
|
||||
CS2_MAPGROUP="mg_active" \
|
||||
CS2_STARTMAP="de_inferno" \
|
||||
CS2_GAMEALIAS="" \
|
||||
CS2_GAMETYPE=0 \
|
||||
CS2_GAMEMODE=1 \
|
||||
CS2_LAN=0 \
|
||||
TV_AUTORECORD=0 \
|
||||
TV_ENABLE=0 \
|
||||
TV_PORT=27020 \
|
||||
TV_PW="changeme" \
|
||||
TV_RELAY_PW="changeme" \
|
||||
TV_MAXRATE=0 \
|
||||
TV_DELAY=0 \
|
||||
SRCDS_TOKEN="" \
|
||||
CS2_CFG_URL="" \
|
||||
CS2_LOG="on" \
|
||||
CS2_LOG_MONEY=0 \
|
||||
CS2_LOG_DETAIL=0 \
|
||||
CS2_LOG_ITEMS=0 \
|
||||
CS2_ADDITIONAL_ARGS=""
|
||||
|
||||
# Set permissions on STEAMAPPDIR
|
||||
# Permissions may need to be reset if persistent volume mounted
|
||||
RUN set -x \
|
||||
&& chown -R "${USER}:${USER}" "${STEAMAPPDIR}" \
|
||||
&& chmod 0777 "${STEAMAPPDIR}"
|
||||
|
||||
# Switch to user
|
||||
USER ${USER}
|
||||
|
||||
WORKDIR ${HOMEDIR}
|
||||
|
||||
CMD ["bash", "entry.sh"]
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 27015/tcp \
|
||||
27015/udp \
|
||||
27020/udp
|
138
bookworm/etc/entry.sh
Normal file
138
bookworm/etc/entry.sh
Normal file
|
@ -0,0 +1,138 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create App Dir
|
||||
mkdir -p "${STEAMAPPDIR}" || true
|
||||
|
||||
# Download Updates
|
||||
|
||||
if [[ "$STEAMAPPVALIDATE" -eq 1 ]]; then
|
||||
VALIDATE="validate"
|
||||
else
|
||||
VALIDATE=""
|
||||
fi
|
||||
|
||||
eval bash "${STEAMCMDDIR}/steamcmd.sh" +force_install_dir "${STEAMAPPDIR}" \
|
||||
+login anonymous \
|
||||
+app_update "${STEAMAPPID}" "${VALIDATE}"\
|
||||
+quit
|
||||
|
||||
# steamclient.so fix
|
||||
mkdir -p ~/.steam/sdk64
|
||||
ln -sfT ${STEAMCMDDIR}/linux64/steamclient.so ~/.steam/sdk64/steamclient.so
|
||||
|
||||
# Install server.cfg
|
||||
cp /etc/server.cfg "${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
|
||||
|
||||
# Install hooks if they don't already exist
|
||||
if [[ ! -f "${STEAMAPPDIR}/pre.sh" ]] ; then
|
||||
cp /etc/pre.sh "${STEAMAPPDIR}/pre.sh"
|
||||
fi
|
||||
if [[ ! -f "${STEAMAPPDIR}/post.sh" ]] ; then
|
||||
cp /etc/post.sh "${STEAMAPPDIR}/post.sh"
|
||||
fi
|
||||
|
||||
# Download and extract custom config bundle
|
||||
if [[ ! -z $CS2_CFG_URL ]]; then
|
||||
echo "Downloading config pack from ${CS2_CFG_URL}"
|
||||
wget -qO- "${CS2_CFG_URL}" | tar xvzf - -C "${STEAMAPPDIR}"
|
||||
fi
|
||||
|
||||
# Rewrite Config Files
|
||||
|
||||
sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \
|
||||
-e "s/{{SERVER_CHEATS}}/${CS2_CHEATS}/g" \
|
||||
-e "s/{{SERVER_HIBERNATE}}/${CS2_SERVER_HIBERNATE}/g" \
|
||||
-e "s/{{SERVER_PW}}/${CS2_PW}/g" \
|
||||
-e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \
|
||||
-e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \
|
||||
-e "s/{{TV_PORT}}/${TV_PORT}/g" \
|
||||
-e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \
|
||||
-e "s/{{TV_PW}}/${TV_PW}/g" \
|
||||
-e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \
|
||||
-e "s/{{TV_MAXRATE}}/${TV_MAXRATE}/g" \
|
||||
-e "s/{{TV_DELAY}}/${TV_DELAY}/g" \
|
||||
-e "s/{{SERVER_LOG}}/${CS2_LOG}/g" \
|
||||
-e "s/{{SERVER_LOG_MONEY}}/${CS2_LOG_MONEY}/g" \
|
||||
-e "s/{{SERVER_LOG_DETAIL}}/${CS2_LOG_DETAIL}/g" \
|
||||
-e "s/{{SERVER_LOG_ITEMS}}/${CS2_LOG_ITEMS}/g" \
|
||||
"${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
|
||||
|
||||
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
|
||||
sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||
fi
|
||||
if [[ ! -z $CS2_BOT_QUOTA ]] ; then
|
||||
sed -i "s/bot_quota.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||
fi
|
||||
if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then
|
||||
sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||
fi
|
||||
|
||||
# Switch to server directory
|
||||
cd "${STEAMAPPDIR}/game/bin/linuxsteamrt64"
|
||||
|
||||
# Pre Hook
|
||||
source "${STEAMAPPDIR}/pre.sh"
|
||||
|
||||
# Construct server arguments
|
||||
|
||||
if [[ -z $CS2_GAMEALIAS ]]; then
|
||||
# If CS2_GAMEALIAS is undefined then default to CS2_GAMETYPE and CS2_GAMEMODE
|
||||
CS2_GAME_MODE_ARGS="+game_type ${CS2_GAMETYPE} +game_mode ${CS2_GAMEMODE}"
|
||||
else
|
||||
# Else, use alias to determine game mode
|
||||
CS2_GAME_MODE_ARGS="+game_alias ${CS2_GAMEALIAS}"
|
||||
fi
|
||||
|
||||
if [[ -z $CS2_IP ]]; then
|
||||
CS2_IP_ARGS=""
|
||||
else
|
||||
CS2_IP_ARGS="-ip ${CS2_IP}"
|
||||
fi
|
||||
|
||||
if [[ ! -z $SRCDS_TOKEN ]]; then
|
||||
SV_SETSTEAMACCOUNT_ARGS="+sv_setsteamaccount ${SRCDS_TOKEN}"
|
||||
fi
|
||||
|
||||
if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]] || [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then
|
||||
CS2_MP_MATCH_END_CHANGELEVEL="+mp_match_end_changelevel true" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368
|
||||
CS2_STARTMAP="\<empty\>" # https://github.com/joedwards32/CS2/issues/57#issuecomment-2245595368
|
||||
CS2_MAPGROUP_ARGS=
|
||||
else
|
||||
CS2_MAPGROUP_ARGS="+mapgroup ${CS2_MAPGROUP}"
|
||||
fi
|
||||
|
||||
if [[ ! -z $CS2_HOST_WORKSHOP_COLLECTION ]]; then
|
||||
CS2_HOST_WORKSHOP_COLLECTION_ARGS="+host_workshop_collection ${CS2_HOST_WORKSHOP_COLLECTION}"
|
||||
fi
|
||||
|
||||
if [[ ! -z $CS2_HOST_WORKSHOP_MAP ]]; then
|
||||
CS2_HOST_WORKSHOP_MAP_ARGS="+host_workshop_map ${CS2_HOST_WORKSHOP_MAP}"
|
||||
fi
|
||||
|
||||
# Start Server
|
||||
|
||||
if [[ ! -z $CS2_RCON_PORT ]]; then
|
||||
echo "Establishing Simpleproxy for ${CS2_RCON_PORT} to 127.0.0.1:${CS2_PORT}"
|
||||
simpleproxy -L "${CS2_RCON_PORT}" -R 127.0.0.1:"${CS2_PORT}" &
|
||||
fi
|
||||
|
||||
echo "Starting CS2 Dedicated Server"
|
||||
eval "./cs2" -dedicated \
|
||||
"${CS2_IP_ARGS}" -port "${CS2_PORT}" \
|
||||
-console \
|
||||
-usercon \
|
||||
-maxplayers "${CS2_MAXPLAYERS}" \
|
||||
"${CS2_GAME_MODE_ARGS}" \
|
||||
"${CS2_MAPGROUP_ARGS}" \
|
||||
+map "${CS2_STARTMAP}" \
|
||||
"${CS2_HOST_WORKSHOP_COLLECTION_ARGS}" \
|
||||
"${CS2_HOST_WORKSHOP_MAP_ARGS}" \
|
||||
"${CS2_MP_MATCH_END_CHANGELEVEL}" \
|
||||
+rcon_password "${CS2_RCONPW}" \
|
||||
"${SV_SETSTEAMACCOUNT_ARGS}" \
|
||||
+sv_password "${CS2_PW}" \
|
||||
+sv_lan "${CS2_LAN}" \
|
||||
"${CS2_ADDITIONAL_ARGS}"
|
||||
|
||||
# Post Hook
|
||||
source "${STEAMAPPDIR}/post.sh"
|
5
bookworm/etc/post.sh
Executable file
5
bookworm/etc/post.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# POST HOOK
|
||||
# Make your customisation here
|
||||
echo "post-hook: noop"
|
5
bookworm/etc/pre.sh
Executable file
5
bookworm/etc/pre.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# PRE HOOK
|
||||
# Make your customisation here
|
||||
echo "pre-hook: noop"
|
44
bookworm/etc/server.cfg
Normal file
44
bookworm/etc/server.cfg
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Server Defaults
|
||||
|
||||
hostname "{{SERVER_HOSTNAME}}" // Set server hostname
|
||||
sv_cheats {{SERVER_CHEATS}} // Enable or disable cheats
|
||||
sv_hibernate_when_empty {{SERVER_HIBERNATE}} // Disable server hibernation
|
||||
|
||||
// Passwords
|
||||
|
||||
rcon_password "{{SERVER_RCON_PW}}" // Set rcon password
|
||||
sv_password "{{SERVER_PW}}" // Set server password
|
||||
|
||||
// CSTV
|
||||
|
||||
sv_hibernate_postgame_delay 30 // Delay server hibernation after all clients disconnect
|
||||
|
||||
tv_allow_camera_man 1 // Auto director allows spectators to become camera man
|
||||
tv_allow_static_shots 1 // Auto director uses fixed level cameras for shots
|
||||
tv_autorecord {{TV_AUTORECORD}} // Automatically records all games as CSTV demos: 0=off, 1=on.
|
||||
tv_chatgroupsize 0 // Set the default chat group size
|
||||
tv_chattimelimit 8 // Limits spectators to chat only every n seconds
|
||||
tv_debug 0 // CSTV debug info.
|
||||
tv_delay {{TV_DELAY}} // CSTV broadcast delay in seconds
|
||||
tv_delaymapchange 1 // Delays map change until broadcast is complete
|
||||
tv_deltacache 2 // Enable delta entity bit stream cache
|
||||
tv_dispatchmode 1 // Dispatch clients to relay proxies: 0=never, 1=if appropriate, 2=always
|
||||
tv_enable {{TV_ENABLE}} // Activates CSTV on server: 0=off, 1=on.
|
||||
tv_maxclients 10 // Maximum client number on CSTV server.
|
||||
tv_maxrate {{TV_MAXRATE}} // Max CSTV spectator bandwidth rate allowed, 0 == unlimited
|
||||
tv_name "{{SERVER_HOSTNAME}} CSTV" // CSTV host name
|
||||
tv_overridemaster 0 // Overrides the CSTV master root address.
|
||||
tv_port {{TV_PORT}} // Host SourceTV port
|
||||
tv_password "{{TV_PW}}" // CSTV password for clients
|
||||
tv_relaypassword "{{TV_RELAY_PW}}" // CSTV password for relay proxies
|
||||
tv_relayvoice 1 // Relay voice data: 0=off, 1=on
|
||||
tv_timeout 60 // CSTV connection timeout in seconds.
|
||||
tv_title "{{SERVER_HOSTNAME}} CSTV" // Set title for CSTV spectator UI
|
||||
tv_transmitall 1 // Transmit all entities (not only director view)
|
||||
|
||||
// Logs
|
||||
|
||||
log {{SERVER_LOG}} // Turns logging 'on' or 'off', defaults to 'on'
|
||||
mp_logmoney {{SERVER_LOG_MONEY}} // Turns money logging on/off: 0=off, 1=on
|
||||
mp_logdetail {{SERVER_LOG_DETAIL}} // Combat damage logging: 0=disabled, 1=enemy, 2=friendly, 3=all
|
||||
mp_logdetail_items {{SERVER_LOG_ITEMS}} // Turns item logging on/off: 0=off, 1=on
|
5
bookworm/hooks/build
Normal file
5
bookworm/hooks/build
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build --target=bookworm-base -t $DOCKER_REPO:latest -t $DOCKER_REPO:base ${SCRIPT_DIR}/..
|
2
bookworm/hooks/push
Normal file
2
bookworm/hooks/push
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
docker push --all-tags ${DOCKER_REPO}
|
Loading…
Add table
Add a link
Reference in a new issue