diff --git a/Dockerfile b/Dockerfile index c177334..efdc566 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,4 +30,6 @@ COPY --chown=steam:steam config $GAME RUN chmod +x ./entrypoint.sh -ENTRYPOINT ["./entrypoint.sh", "-timeout 6"] \ No newline at end of file +ENTRYPOINT ["./entrypoint.sh", "-timeout 6"] + +CMD ["-game", "${GAME}"] \ No newline at end of file diff --git a/README.md b/README.md index c5a441b..3cf1bd5 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,38 @@ -# Half-Life Dedicated Server Docker +# Half-Life Dedicated Server With Docker -Initializes a Half-Life Dedicated Server. +Creates a Half-Life Dedicated Server instance using Docker. You can configure the server client however you'd like, and for any official games that are supported by the GoldSrc Dedicated Server client. -## Setp +## Setup -1. Define the mod you wish to build. +Ensure you have the [Docker daemon installed and running](https://www.docker.com/). -```bash -export MOD=cstrike +> [!IMPORTANT] +> The following steps will not work if you're using a system running on ARM or Mac Silicone architecture. + +1. Define the game you want to start the server for, and set it in the `GAME` section of `docker-compose.yml`. + +```yml +services: + hlds: + environment: + game: "cstrike" ``` -2. Build the image +> [!IMPORTANT] +> Possible options include Half-Life Deathmatch (`valve`), Counter-Strike (`cstrike`), Counter-Strike Condition Zero (`czero`), Deathmatch Classic (`dmc`), Opposing Force (`gearbox`), Ricochet (`ricochet`), Day of Defeat (`dod`), and Team Fortress Classic (`tfc`). + +2. Build the image. ```sh docker compose build ``` -3. Start the image +3. Start the image. ```sh docker compose up ``` -## Configs +## Server Configuration -If you wish to define server configurations, such as addons, motd, server configs, etc, add them to the `config` directory. These will be volume mapped into the container on startup. +If you wish to define server configurations, such as addons, plugins, custom message of the days, map rotations, etc, you can add them to the `config` directory. These will be copied into the container on startup of your server. diff --git a/config/default.cfg b/config/default.cfg index a1f81a8..7866844 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1,2 +1,5 @@ // Defines the default configuration for the server +// This file is executed automatically when the server starts +// Docs: https://developer.valvesoftware.com/ + hostname "The Coffee House" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b4c4408..94ba5b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,5 +9,4 @@ services: - "./config:/config" ports: - "27015:27015/udp" - command: -game ${GAME} +maxplayers 12 +map cs_italy +rcon_password "replace_me" +log on - network_mode: "host" + command: -game ${GAME} +maxplayers 12 +map cs_italy +log on diff --git a/entrypoint.sh b/entrypoint.sh index 2077e2b..1411a04 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,4 +7,4 @@ fi echo Starting Half-Life Dedicated Server... -./hlds_run "-game ${GAME} $@" +./hlds_run "$@"