This directory contains a template for creating Docker images for game servers. The init.sh script automates the process of setting up a new game server image repository based on the provided Steam app ID for the game server.
- Repositories are named in kebab-case with "-server" added to the base game name.
- The game install directory is named in PascalCase of the game name.
PORT,QUERYPORT, andSERVERNAMEshould be consistent across all repositories.RCONPORTis the standard name if the server supports RCON and should also be consistent across all repositories.
To create a new game server image repository, follow these steps:
- Navigate to the
game-server-templatedirectory. - Run the
init.shscript with the required options.
./init.sh -i <steam_app_id> [-b <image_base>]-i: Specify the Steam app ID of the game server.-b: (Optional) Override the image base. If not provided, the script will determine the appropriate base image based on the game's compatibility with Linux.-h: Show the help message.
./init.sh -i 294420This command will create a new directory for the game server image, populate it with the necessary files, and replace placeholders with the appropriate values.
After running the init.sh script, the new game server image directory will have the following structure:
<game-server-image-name>/
├── Dockerfile
├── docker-compose.yml
├── base.Dockerfile
├── README.md
└── ...
The following placeholders in the template files will be replaced with actual values:
{{GAME_APP_ID}}: The Steam app ID of the game server.{{GAME_NAME}}: The name of the game.{{GAME_NAME_PASCAL_CASE}}: The name of the game in PascalCase.{{GAME_SERVER_IMAGE_NAME}}: The name of the game server image in kebab-case.{{IMAGE_BASE}}: The base image for the game server.
jq: The script requiresjqto parse JSON data. Please ensure it is installed on your system.
- The script checks if the game server has a Linux depot. If not, it defaults to using
steamcmd-wineas the base image. - The script creates a new directory for the game server image and copies the template files into it, replacing the placeholders with the actual values.
For more information, refer to the comments in the init.sh script.
This project is licensed under the MIT License.
If you enjoy this project and would like to support my work, consider buying me a coffee. Your support is greatly appreciated!