HLDS Docker Server Management
This skill helps you build, configure, and manage Half-Life Dedicated Server (HLDS) using Docker containers. It supports classic GoldSrc games and mods including Counter-Strike 1.6, Team Fortress Classic, Day of Defeat, and more, with full CI/CD automation.
What This Skill Does
Assists with building custom HLDS Docker images for multiple GoldSrc gamesGuides configuration of server settings, plugins, and custom modsHelps manage Docker Compose setups and volume mappingsSupports writing and debugging GitHub Actions workflows for image validation and publishingProvides context-aware suggestions for entrypoint scripts and SteamCMD integrationInstructions for AI Agent
When helping users with HLDS Docker server management, follow these guidelines:
1. Repository Structure Understanding
The project follows this structure:
`container/Dockerfile` - Main Docker image definition with build arguments`container/entrypoint.sh` - Server initialization and startup script`config/` - Server configuration files (server.cfg, motd.txt, etc.)`mods/` - Custom mods and plugins directory`.github/workflows/` - CI/CD automation (validate.yml, beta.yml, publish.yml)2. Dockerfile Assistance
When modifying or creating Dockerfiles:
Use build arguments: `GAME`, `FLAG`, `VERSION`, `IMAGE`Follow multi-stage build patterns for minimal image sizeEnsure SteamCMD integration for downloading game filesSupport custom mod installation during build processExample build command structure: ```dockerfile
ARG GAME=cstrike
ARG FLAG="-game ${GAME} +maxplayers 32 +map de_dust2"
```
3. Server Configuration
For server configuration tasks:
Configuration files in `config/` are copied into container or mounted as volumesKey files: `server.cfg`, `motd.txt`, `mapcycle.txt`, `banned.cfg`Volume mappings allow runtime customization without rebuilding imagesSupport both build-time copy and runtime mount strategies4. Supported Games
Provide guidance for these GoldSrc games:
`valve` - Half-Life Deathmatch`cstrike` - Counter-Strike 1.6`czero` - Counter-Strike Condition Zero`dod` - Day of Defeat`tfc` - Team Fortress Classic`dmc` - Deathmatch Classic`gearbox` - Half-Life Opposing Force`ricochet` - Ricochet5. Entrypoint Script Logic
When working with `entrypoint.sh`:
Initialize server by copying config files to game directoryHandle custom plugins and mods from mounted volumesStart HLDS with correct game flags and argumentsSupport environment variable substitution for runtime configurationExample initialization pattern: ```bash
cp -r /config/* /hlds/${GAME}/
cp -r /mods/* /hlds/${GAME}/addons/
./hlds_run -game ${GAME} ${SERVER_FLAGS}
```
6. Docker Compose Management
For Docker Compose configurations:
Map volumes for configs: `./config:/config:ro`Map volumes for mods: `./mods:/mods:ro`Expose game ports (typically 27015/udp)Set environment variables for game selection and flagsExample service definition: ```yaml
services:
hlds:
image: jamesives/hlds:cstrike
ports:
- "27015:27015/udp"
volumes:
- ./config:/config:ro
- ./mods:/mods:ro
environment:
- GAME=cstrike
```
7. GitHub Actions Workflows
When working with CI/CD automation:
**validate.yml** - Test image functionality, verify directory mappings, validate game data**beta.yml** - Build and publish beta/testing images**publish.yml** - Build and publish production-ready imagesImplement caching strategies for faster buildsParallelize multi-game image builds where possibleInclude validation steps: container startup, volume mapping checks, game file verification8. Custom Mods and Plugins
For custom mod support:
Place mods in `mods/` directorySupport both build-time inclusion and runtime mountingHandle AMX Mod X, Metamod, and other plugin frameworksEnsure proper file permissions and directory structureDocument mod-specific configuration requirements9. Debugging and Troubleshooting
When helping debug issues:
Check volume mappings for config and mod filesVerify SteamCMD downloaded game files correctlyValidate entrypoint script logic and permissionsReview container logs for HLDS startup errorsTest network port accessibility (UDP/TCP)Verify build arguments match expected game types10. Best Practices
Always recommend:
Use minimal base images (Alpine or Debian slim)Implement proper error handling in shell scriptsFollow Docker layer caching best practicesDocument all environment variables and build argumentsEnsure compliance with Valve's licensing termsUse read-only volume mounts where appropriateImplement health checks for container monitoringExamples
Building a Custom Counter-Strike Server
```bash
Build the image
docker build --build-arg GAME=cstrike -t my-cs-server ./container
Run with custom config
docker run -d \
-p 27015:27015/udp \
-v ./my-config:/config:ro \
-v ./my-mods:/mods:ro \
my-cs-server
```
Creating a Multi-Game Docker Compose Setup
```yaml
version: '3.8'
services:
cs-server:
image: jamesives/hlds:cstrike
ports:
- "27015:27015/udp"
volumes:
- ./cs-config:/config:ro
tfc-server:
image: jamesives/hlds:tfc
ports:
- "27016:27015/udp"
volumes:
- ./tfc-config:/config:ro
```
Adding a Validation Workflow Step
```yaml
name: Validate Server Startup run: |
docker run -d --name test-hlds jamesives/hlds:cstrike
sleep 10
docker logs test-hlds | grep "Server is ready"
docker exec test-hlds ls -la /hlds/cstrike
```
Constraints
Always respect Valve's licensing terms and terms of serviceDo not include copyrighted game content in public repositoriesEnsure server configurations comply with game-specific rulesUse SteamCMD for legitimate game file downloads onlyConsider security implications of exposed game server portsTest volume mappings thoroughly before production deploymentRelated Documentation
Docker best practices for multi-stage buildsSteamCMD command reference for HLDSGoldSrc game server configuration guidesGitHub Actions workflow syntax and features