Update files
This commit is contained in:
parent
38b2938f79
commit
4cfa6d653b
4 changed files with 48 additions and 50 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1 @@
|
||||||
.idea
|
.cs2.env
|
||||||
|
|
54
README.md
54
README.md
|
@ -1,52 +1,51 @@
|
||||||
[](https://github.com/joedwards32/CS2/actions/workflows/docker-image.yml) [](https://github.com/joedwards32/CS2/actions/workflows/docker-publish.yml)
|
|
||||||
|
|
||||||
# What is Counter-Strike 2?
|
# What is Counter-Strike 2?
|
||||||
For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is Counter-Strike 2.
|
For over two decades, Counter-Strike has offered an elite competitive experience, one shaped by millions of players from across the globe. And now the next chapter in the CS story is about to begin. This is [Counter-Strike 2](https://store.steampowered.com/app/730/CounterStrike_2/).
|
||||||
This Docker image contains the dedicated server of the game.
|
This Docker image contains the dedicated server of the game.
|
||||||
|
|
||||||
> [CS2](https://store.steampowered.com/app/730/CounterStrike_2/)
|
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/730/header.jpg?t=1696011820" alt="logo" width="600"/></img>
|
||||||
|
|
||||||
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/730/header.jpg?t=1696011820" alt="logo" width="300"/></img>
|
|
||||||
|
|
||||||
# How to use this image
|
# How to use this image
|
||||||
## Hosting a simple game server
|
## Hosting a simple game server
|
||||||
|
|
||||||
Running using Docker:
|
Running on the *host* interface (recommended):<br/>
|
||||||
```console
|
```console
|
||||||
$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers
|
$ docker run -d --net=host --name=cs2 -e STEAMUSER={YOUR_STEAM_USER} -e STEAMPASS={YOUR_STEAM_PASSWD} git.zio.sh/astra/cs2:latest
|
||||||
$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Running using a bind mount for data persistence on container recreation:
|
Running using a bind mount for data persistence on container recreation:
|
||||||
```console
|
```console
|
||||||
$ mkdir -p $(pwd)/cs2-data
|
$ mkdir -p $(pwd)/cs2-data
|
||||||
$ chown 1000:1000 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user with uid 1000, known as steam
|
$ chmod 777 $(pwd)/cs2-data # Makes sure the directory is writeable by the unprivileged container user
|
||||||
$ SRCDS_TOKEN="..." # check https://steamcommunity.com/dev/managegameservers
|
$ docker run -d \
|
||||||
$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2
|
--net=host \
|
||||||
|
-v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ \
|
||||||
|
--name=cs2-dedicated \
|
||||||
|
-e STEAMUSER=<YOUR_STEAM_USER> \
|
||||||
|
-e STEAMPASS=<YOUR_STEAM_PASSWD> \
|
||||||
|
git.zio.sh/astra/cs2:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
or using docker-compose, see [examples](https://github.com/joedwards32/CS2/blob/main/examples/docker-compose.yml):
|
`STEAMUSER` and `STEAMPASS` **are required as unlike CS:GO, CS2 can not be downloaded anonymously (at time of writing).**
|
||||||
```console
|
|
||||||
# Remember to update passwords and SRCDS_TOKEN in your compose file
|
|
||||||
$ docker compose --file examples/docker-compose.yml up -d cs2-server
|
|
||||||
```
|
|
||||||
|
|
||||||
You must have at least **40GB** of free disk space! See [System Requirements](./#system-requirements).
|
`STEAMGUARD` **must be used to provide your more recent Steam Guard key if Steam Guard is enabled on your account.**
|
||||||
|
|
||||||
**The container will automatically update the game on startup, so if there is a game update just restart the container.**
|
**The container will automatically update the game on startup, so if there is a game update just restart the container.**
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
## System Requirements
|
## System Requirements
|
||||||
|
Please note that you need approximately 1.5g of free RAM. If this is not available, container will crash with err 137.
|
||||||
Minimum system requirements are:
|
|
||||||
|
|
||||||
* 2 CPUs
|
|
||||||
* 2GiB RAM
|
|
||||||
* 40GB of disk space for the container or mounted as a persistent volume on `/home/steam/cs2-dedicated/`
|
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
Feel free to overwrite these environment variables, using -e (--env):
|
Feel free to overwrite these environment variables, using -e (--env) or --env-file (recommended):
|
||||||
|
|
||||||
|
### SteamCMD
|
||||||
|
|
||||||
|
```dockerfile
|
||||||
|
STEAMUSER="changeme" (Steam User for SteamCMD.)
|
||||||
|
STEAMPASS="changeme" (Password for Steam User.)
|
||||||
|
STEAMGUARD="" (Optional, Steam Guard key if enabled. Use your most recent Steam Guard key.)
|
||||||
|
```
|
||||||
|
|
||||||
### Server Configuration
|
### Server Configuration
|
||||||
|
|
||||||
|
@ -63,7 +62,7 @@ CS2_RCON_PORT="" (Optional, use a simple TCP proxy to have RCON liste
|
||||||
Useful for services like AWS Fargate which do not support mixed protocol ports.)
|
Useful for services like AWS Fargate which do not support mixed protocol ports.)
|
||||||
CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled)
|
CS2_LAN="0" (0 - LAN mode disabled, 1 - LAN Mode enabled)
|
||||||
CS2_RCONPW="changeme" (RCON password)
|
CS2_RCONPW="changeme" (RCON password)
|
||||||
CS2_PW="" (Optional, CS2 server password)
|
CS2_PW="changeme" (Optional, CS2 server password)
|
||||||
CS2_MAXPLAYERS=10 (Max players)
|
CS2_MAXPLAYERS=10 (Max players)
|
||||||
CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2)
|
CS2_ADDITIONAL_ARGS="" (Optional additional arguments to pass into cs2)
|
||||||
```
|
```
|
||||||
|
@ -179,9 +178,6 @@ The container can be instructed to download a extract a Tar Gzip bundle, Tar or
|
||||||
CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods)
|
CS2_CFG_URL="" (HTTP/HTTPS URL to fetch a Tar Gzip bundle, Tar or Zip archive of configuration files/mods)
|
||||||
```
|
```
|
||||||
|
|
||||||
See [examples](https://github.com/joedwards32/CS2/blob/main/examples/cs2.cfg.tgz) for a correctly formatted Tar Gzip customisation bundle, the same format applies to all archive types.
|
|
||||||
|
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!
|
This container leans heavily on the work of [CM2Walki](https://github.com/CM2Walki/), especially his [SteamCMD](https://github.com/CM2Walki/steamcmd) container image. GG!
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
FROM cm2network/steamcmd:root-bookworm as build_stage
|
FROM cm2network/steamcmd:root-bookworm as build_stage
|
||||||
|
|
||||||
LABEL maintainer="joedwards32@gmail.com"
|
LABEL maintainer="astra@zio.sh"
|
||||||
|
|
||||||
ENV STEAMAPPID 730
|
ENV STEAMAPPID 730
|
||||||
ENV STEAMAPP cs2
|
ENV STEAMAPP cs2
|
||||||
|
@ -20,8 +20,10 @@ COPY etc/post.sh "/etc/post.sh"
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
# Install, update & upgrade packages
|
# Install, update & upgrade packages
|
||||||
|
&& dpkg --add-architecture i386 \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends --no-install-suggests \
|
&& apt-get install -y --no-install-recommends --no-install-suggests \
|
||||||
|
libcurl4:i386 \
|
||||||
wget \
|
wget \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
lib32z1 \
|
lib32z1 \
|
||||||
|
@ -29,10 +31,12 @@ RUN set -x \
|
||||||
libicu-dev \
|
libicu-dev \
|
||||||
unzip \
|
unzip \
|
||||||
jq \
|
jq \
|
||||||
|
patch \
|
||||||
&& mkdir -p "${STEAMAPPDIR}" \
|
&& mkdir -p "${STEAMAPPDIR}" \
|
||||||
# Add entry script
|
# Add entry script
|
||||||
&& chmod +x "${HOMEDIR}/entry.sh" \
|
&& chmod +x "${HOMEDIR}/entry.sh" \
|
||||||
&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \
|
&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" \
|
||||||
|
&& chmod +x /etc/post.sh /etc/pre.sh \
|
||||||
# Clean up
|
# Clean up
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& find /var/lib/apt/lists/ -type f -delete
|
&& find /var/lib/apt/lists/ -type f -delete
|
||||||
|
|
|
@ -100,32 +100,30 @@ fi
|
||||||
|
|
||||||
# Rewrite Config Files
|
# Rewrite Config Files
|
||||||
|
|
||||||
sed -i -e "s/{{SERVER_HOSTNAME}}/${CS2_SERVERNAME}/g" \
|
sed -r -i -e "s/^(hostname) .*/\1 ${CS2_SERVERNAME}/g" \
|
||||||
-e "s/{{SERVER_CHEATS}}/${CS2_CHEATS}/g" \
|
-e "s/^(sv_cheats) .*/\1 ${CS2_CHEATS}/g" \
|
||||||
-e "s/{{SERVER_HIBERNATE}}/${CS2_SERVER_HIBERNATE}/g" \
|
-e "s/^(sv_hibernate_when_empty) .*/\1 ${CS2_SERVER_HIBERNATE}/g" \
|
||||||
-e "s/{{SERVER_PW}}/${CS2_PW}/g" \
|
-e "s/^(sv_password) .*/\1 ${CS2_PW}/g" \
|
||||||
-e "s/{{SERVER_RCON_PW}}/${CS2_RCONPW}/g" \
|
-e "s/^(rcon_password) .*/\1 ${CS2_RCONPW}/g" \
|
||||||
-e "s/{{TV_ENABLE}}/${TV_ENABLE}/g" \
|
-e "s/^(tv_enable) .*/\1 ${TV_ENABLE}/g" \
|
||||||
-e "s/{{TV_PORT}}/${TV_PORT}/g" \
|
-e "s/^(tv_port) .*/\1 ${TV_PORT}/g" \
|
||||||
-e "s/{{TV_AUTORECORD}}/${TV_AUTORECORD}/g" \
|
-e "s/^(tv_autorecord) .*/\1 ${TV_AUTORECORD}/g" \
|
||||||
-e "s/{{TV_PW}}/${TV_PW}/g" \
|
-e "s/^(tv_password) .*/\1 ${TV_PW}/g" \
|
||||||
-e "s/{{TV_RELAY_PW}}/${TV_RELAY_PW}/g" \
|
-e "s/^(tv_relaypassword) .*/\1 ${TV_RELAY_PW}/g" \
|
||||||
-e "s/{{TV_MAXRATE}}/${TV_MAXRATE}/g" \
|
-e "s/^(tv_maxrate) .*/\1 ${TV_MAXRATE}/g" \
|
||||||
-e "s/{{TV_DELAY}}/${TV_DELAY}/g" \
|
-e "s/^(tv_delay) .*/\1 ${TV_DELAY}/g" \
|
||||||
-e "s/{{SERVER_LOG}}/${CS2_LOG}/g" \
|
-e "s/^(tv_name) .*/\1 ${CS2_SERVERNAME} CSTV/g" \
|
||||||
-e "s/{{SERVER_LOG_MONEY}}/${CS2_LOG_MONEY}/g" \
|
-e "s/^(tv_title) .*/\1${CS2_SERVERNAME} CSTV/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
|
"${STEAMAPPDIR}"/game/csgo/cfg/server.cfg
|
||||||
|
|
||||||
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
|
if [[ ! -z $CS2_BOT_DIFFICULTY ]] ; then
|
||||||
sed -i "s/bot_difficulty.*/bot_difficulty ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
sed -r -i "s/^(bot_difficulty) .*/\1 ${CS2_BOT_DIFFICULTY}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||||
fi
|
fi
|
||||||
if [[ ! -z $CS2_BOT_QUOTA ]] ; then
|
if [[ ! -z $CS2_BOT_QUOTA ]] ; then
|
||||||
sed -ri "s/bot_quota[[:space:]]+.*/bot_quota ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
sed -r -i "s/^(bot_quota) .*/\1 ${CS2_BOT_QUOTA}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||||
fi
|
fi
|
||||||
if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then
|
if [[ ! -z $CS2_BOT_QUOTA_MODE ]] ; then
|
||||||
sed -i "s/bot_quota_mode.*/bot_quota_mode ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
sed -r -i "s/^(bot_quota_mode) .*/\1 ${CS2_BOT_QUOTA_MODE}/" "${STEAMAPPDIR}"/game/csgo/cfg/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Switch to server directory
|
# Switch to server directory
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue