Skip to content

Commit

Permalink
feat: ✨ Add custom mod support (#7)
Browse files Browse the repository at this point in the history
* test: add mods here

* feat: ✨ Add mod instructions and example

* t

* Update .gitignore

* Update entrypoint.sh
  • Loading branch information
JamesIves authored Jun 13, 2024
1 parent 329e299 commit 394d437
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
config/*
configs/*
mods/*
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN groupadd -r steam && \
useradd -r -g steam -m -d /opt/steam steam

RUN mkdir /config
RUN mkdir /mods

USER steam
WORKDIR /opt/steam
Expand All @@ -31,6 +32,7 @@ WORKDIR /opt/steam/hlds

COPY --chown=steam:steam ./entrypoint.sh ./entrypoint.sh
COPY --chown=steam:steam config $GAME
COPY --chown=steam:steam mods .

RUN chmod +x ./entrypoint.sh

Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,32 @@ docker compose up

## Server Configuration 🔧

### Configs and Plugins

If you wish to add server configurations, such as add-ons, plugins, map rotations, etc, you can add them to the `config` directory. Any configuration files will be copied into the container on build and placed within the folder for the specified game. For example, if you set the game as `cstrike`, the contents of the config folder will be placed within the `cstrike` directory on the server.

Additionally, you can customize the server by manually building the images and making adjustments to the `Dockerfile`. This may be useful if you're trying to run a custom mod.
### Custom Mods

If you want to run a custom mod, you can do so with the `mods` directory. Similar to the `config` directory, this folder will be copied into your container on build alongside the other game folders.

1. Add your mod files as a sub-directory of `config`. For example if the mod name is `decay`, you'd place it in `mods/decay`.
2. Define the `game` environment variable so it points to your mod name.

```bash
export GAME=decay
```

3. Build the image.

```bash
docker compose build
```

4. Start the image. Most Half-Life mods require _specific_ startup arguments, refer to the [Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Half-Life_Dedicated_Server) and the instructions for the mod you're trying to run for more details. You can find details about how to add these above.

```bash
docker compose up
```

## Ownership 🧰

Expand Down
1 change: 1 addition & 0 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For details on how to use this directory refer to the Server Configuration section of the README.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
GAME: ${GAME}
volumes:
- "./config:/config"
- "./mods:/mods"
ports:
- "27015:27015/udp"
command: +maxplayers 12 +log on
5 changes: 0 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ if echo "$@" | grep -qv "+map"; then
echo -e "\e[33mWarning: No +map specified in the command. Server will start but may not be joinable.\e[0m"
fi

if [ -d /temp/hlds ]
then
rsync --chown=steam:steam /temp/hlds/* /opt/steam/hlds/$GAME
fi

echo -e "\e[32mStarting Half-Life Dedicated Server...\e[0m"

./hlds_run "-game $GAME $@"
1 change: 1 addition & 0 deletions mods/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
For details on how to use this directory refer to the Server Configuration section of the README.

0 comments on commit 394d437

Please sign in to comment.