A Counter-Strike 2 server that runs in docker with pre-baked CSS plugins
- This docker image uses the joedwards32/cs2 image as its base image.
- When the container starts, it will download Counter-Strike 2 into the
/home/steam/cs2-dedicated
directory, which also happens to be a volume. If the game is already present in the volume, it will attempt to update it. - Once the game is fully downloaded and up-to-date, it will run the dedicated game server.
- Before running the server, it will run a
pre.sh
hook. By default this hook does nothing, but our Dockerfile overwrites the file with the contents in hooks/pre.sh. - Because of how the base image is configured, the hook scripts are only copied if they do not currently exist in the
/home/steam/cs2-dedicated
directory. To get around any potential caching issues, we've configured our version of thepre.sh
hook to create and execute another script by proxy. The hook will delete the existing proxy script and copy over the latest file to ensure we're running the most up-to-date version, without needing to change thepre.sh
script.
- Before running the server, it will run a
- The install plugins script executed by the pre-hook will install metamod and CounterStrikeSharp if they do not already exist. It will also install any CounterStrikeSharp plugins copied to the Docker image in the
/tmp/plugins
directory.- Plugins are added as git submodules in the plugins directory and are built in a build stage in the Dockerfile.
- When a pull request is merged into the
main
branch, a github action will build the docker image, push it to AWS Elastic Container Registry, and a task definition is deployed to AWS Elastic Container Service with the newly published image.
- Clone the repository
git clone [email protected]:atakanCocen/cs2-docker.git cd cs2-docker
- Initialize and update the submodules
git submodule update --init --recursive
- Build the docker image
docker build -t cs2-server .