Unturned rewrite
Build / latest (push) Failing after 10s

This commit is contained in:
2026-06-14 10:40:57 +02:00
parent 0483cb44cd
commit a777dfb888
4 changed files with 101 additions and 136 deletions
+3 -3
View File
@@ -31,9 +31,9 @@ jobs:
- name: Build docker - name: Build docker
run: | run: |
docker build -t git.sh-edraft.de/sh-edraft.de/garrysmod . docker build -t git.sh-edraft.de/sh-edraft.de/unturned .
- name: Push image - name: Push image
run: | run: |
docker push git.sh-edraft.de/sh-edraft.de/garrysmod docker push git.sh-edraft.de/sh-edraft.de/unturned
+31 -40
View File
@@ -1,46 +1,37 @@
FROM hackebein/srcds FROM cm2network/steamcmd:root
ENV \ ENV \
# App # Server identity
APPS="4020 -validate -language en,232330 -validate -language en" \ INSTANCEID="Server1" \
# SERVERNAME="Unturned Server" \
# API SERVERPASSWORD="" \
# http://steamcommunity.com/dev/apikey ADMINPASSWORD="" \
AUTHKEY="" \ OWNER="0" \
#
# Public access
# automatic via API
GLSTAPP="4000" \
# manual
# APPID: 4000
# http://steamcommunity.com/dev/managegameservers
GLST="" \
#
# Workshop server download (require API)
WORKSHOP="\${WORKSHOPCOLLECTIONID:-}" \
#
# Workshop client download (require API)
WORKSHOPDL="" \
# #
# Server config # Server config
GAME="garrysmod" \ MAP="PEI" \
TICKRATE="66" \ MAXPLAYERS="8" \
MAXPLAYERS="16" \ PERSPECTIVE="Both" \
GAMEMODE="sandbox" \ PVP="true" \
GAMETYPE="0" \ PORT="27015" \
MAP="gm_flatgrass" \ #
MAPGROUP="mg_active" \ # Anti-cheat
CONFIG="server.cfg" \ VAC="true" \
EASYANTICHEAT="true" \
#
# Workshop
WORKSHOP="" \
# #
# Start parameters # Start parameters
SRCDSPARAMS="\ CUSTOMPARAMETERS=""
-game \${GAME} \
-tickrate \${TICKRATE} \ WORKDIR /home/steam/unturned
-maxplayers \${MAXPLAYERS} \
-authkey \${AUTHKEY} \ RUN steamcmd +force_install_dir /home/steam/unturned +login anonymous +app_update 1110390 validate +quit
+host_workshop_collection \${WORKSHOP} \
+gamemode \${GAMEMODE} \ COPY entrypoint.sh /entrypoint.sh
+map \${MAP} \ RUN chmod +x /entrypoint.sh
+servercfgfile \${CONFIG} \
\${CUSTOMPARAMETERS} \ EXPOSE 27015/udp 27015/tcp 27016/udp
"
ENTRYPOINT ["/entrypoint.sh"]
+41 -93
View File
@@ -1,143 +1,91 @@
# docker-garrysmod # docker-unturned
A Docker image for running a [Garry's Mod](https://gmod.facepunch.com/) dedicated server, based on [hackebein/docker-srcds](https://github.com/Hackebein/docker-srcds). A Docker image for running an [Unturned](https://unturned.smartlydressedgames.com/) dedicated server, using SteamCMD.
This repository is a fork of [Hackebein/docker-garrysmod](https://github.com/Hackebein/docker-garrysmod).
Garry's Mod is a physics sandbox. There aren't any predefined aims or goals. The game gives you the tools and leaves you to play.
The image is automatically built and pushed to: The image is automatically built and pushed to:
```text ```text
git.sh-edraft.de/sh-edraft.de/garrysmod git.sh-edraft.de/sh-edraft.de/unturned
``` ```
## Table of Contents ## Table of Contents
- [Quick Start](#quick-start) - [Quick Start](#quick-start)
- [Enabling the Steam API](#enabling-the-steam-api) - [Server Identity](#server-identity)
- [Public Listing](#public-listing) - [Workshop Mods](#workshop-mods)
- [Workshop Collections](#workshop-collections) - [Persisting Data](#persisting-data)
- [Custom Server Configuration](#custom-server-configuration)
- [Example: Trouble in Terrorist Town (TTT)](#example-trouble-in-terrorist-town-ttt)
- [Environment Variables](#environment-variables) - [Environment Variables](#environment-variables)
- [Overlay Folder](#overlay-folder)
- [Further Configuration](#further-configuration)
## Quick Start ## Quick Start
Start a basic sandbox server on the default port (`27015`): Start a basic PEI server on the default port (`27015`):
```bash ```bash
docker run -it \ docker run -it \
-p 27015:27015/tcp \ -p 27015:27015/tcp \
-p 27015:27015/udp \ -p 27015:27015/udp \
git.sh-edraft.de/sh-edraft.de/garrysmod -p 27016:27016/udp \
git.sh-edraft.de/sh-edraft.de/unturned
``` ```
## Enabling the Steam API ## Server Identity
Some features (public server listing, Workshop downloads) require a Steam Web API key. Set a server name, instance id, password and owner SteamID64:
```bash ```bash
docker run -it \ docker run -it \
-p 27015:27015/tcp \ -p 27015:27015/tcp \
-p 27015:27015/udp \ -p 27015:27015/udp \
-e "AUTHKEY=..." \ -p 27016:27016/udp \
git.sh-edraft.de/sh-edraft.de/garrysmod -e "INSTANCEID=MyServer" \
-e "SERVERNAME=My Server" \
-e "SERVERPASSWORD=secret" \
-e "ADMINPASSWORD=adminsecret" \
-e "OWNER=76561198000000000" \
git.sh-edraft.de/sh-edraft.de/unturned
``` ```
Get your `AUTHKEY` from <http://steamcommunity.com/dev/apikey>. ## Workshop Mods
## Public Listing Set a space-separated list of Workshop item/collection IDs to subscribe to on startup:
If you've set `AUTHKEY`, your server is automatically listed publicly. Alternatively, you can register a Game Server Login Token (GLST) manually:
```bash ```bash
docker run -it \ docker run -it \
-p 27015:27015/tcp \ -p 27015:27015/tcp \
-p 27015:27015/udp \ -p 27015:27015/udp \
-e "GLST=..." \ -p 27016:27016/udp \
git.sh-edraft.de/sh-edraft.de/garrysmod -e "WORKSHOP=123456789 987654321" \
git.sh-edraft.de/sh-edraft.de/unturned
``` ```
Get your `GLST` from <http://steamcommunity.com/dev/managegameservers> (App ID: `4000`). ## Persisting Data
## Workshop Collections Mount the `Servers` directory to persist save data, configs and workshop mods across container restarts:
Downloading Workshop content requires `AUTHKEY` to be set.
```bash ```bash
docker run -it \ docker run -it \
-p 27015:27015/tcp \ -p 27015:27015/tcp \
-p 27015:27015/udp \ -p 27015:27015/udp \
-e "AUTHKEY=..." \ -p 27016:27016/udp \
-e "WORKSHOPCOLLECTIONID=..." \ -v ./servers:/home/steam/unturned/Servers \
git.sh-edraft.de/sh-edraft.de/garrysmod git.sh-edraft.de/sh-edraft.de/unturned
``` ```
## Custom Server Configuration
Mount your own `server.cfg` into the container:
```bash
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-v ./server.cfg:/opt/steam/garrysmod/cfg/server.cfg \
git.sh-edraft.de/sh-edraft.de/garrysmod
```
## Example: Trouble in Terrorist Town (TTT)
```bash
# make sure the server.cfg file exists
touch ./server.cfg
# start the container
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e "AUTHKEY=..." \
-e "GAMEMODE=terrortown" \
-e "MAP=ttt_minecraft_b5" \
-e "WORKSHOP=843519054" \
-e "WORKSHOPDL=843519054" \
-v ./server.cfg:/opt/steam/garrysmod/cfg/server.cfg \
-v ./overlay:/opt/overlay \
git.sh-edraft.de/sh-edraft.de/garrysmod
```
This uses the [TTT Workshop Collection](https://steamcommunity.com/sharedfiles/filedetails/?id=843519054), downloaded both server-side (`WORKSHOP`) and client-side (`WORKSHOPDL`).
## Environment Variables ## Environment Variables
| Variable | Description | Default | | Variable | Description | Default |
| --- | --- | --- | | --- | --- | --- |
| `AUTHKEY` | Steam Web API key. Required for the public server list and Workshop downloads. Get one at <http://steamcommunity.com/dev/apikey> | _(empty)_ | | `INSTANCEID` | Server instance id, used as the directory name under `Servers/` | `Server1` |
| `GLST` | Game Server Login Token for public listing. Get one at <http://steamcommunity.com/dev/managegameservers> (App ID `4000`). Not needed if `AUTHKEY` is set | _(empty)_ | | `SERVERNAME` | Name shown in the server browser | `Unturned Server` |
| `GAME` | Game mod directory | `garrysmod` | | `SERVERPASSWORD` | Password required to join the server | _(empty)_ |
| `GAMEMODE` | Gamemode to run on server start | `sandbox` | | `ADMINPASSWORD` | Password required for admin access | _(empty)_ |
| `MAP` | Map to load on server start | `gm_flatgrass` | | `OWNER` | SteamID64 of the server owner | `0` |
| `MAPGROUP` | Map group / map cycle group | `mg_active` | | `MAP` | Map to load on server start | `PEI` |
| `GAMETYPE` | Game type passed to the server | `0` | | `MAXPLAYERS` | Maximum number of players | `8` |
| `MAXPLAYERS` | Maximum number of players | `16` | | `PERSPECTIVE` | Allowed perspectives (`Both`, `First`, `Third`) | `Both` |
| `TICKRATE` | Server tickrate. **Note:** changing this is not recommended | `66` | | `PVP` | Enable player-vs-player damage | `true` |
| `CONFIG` | Server config file, relative to `cfg/`. **Note:** changing this is not recommended | `server.cfg` | | `PORT` | Game port | `27015` |
| `WORKSHOP` | Workshop collection ID to download for the server | _(empty)_ | | `VAC` | Enable Valve Anti-Cheat | `true` |
| `WORKSHOPDL` | Workshop collection ID for clients to download before joining | _(empty)_ | | `EASYANTICHEAT` | Enable Easy Anti-Cheat | `true` |
| `WORKSHOP` | Space-separated Workshop item/collection IDs to download | _(empty)_ |
| `CUSTOMPARAMETERS` | Additional raw command-line parameters appended to the server start command | _(empty)_ | | `CUSTOMPARAMETERS` | Additional raw command-line parameters appended to the server start command | _(empty)_ |
## Overlay Folder
You can use an overlay folder to add or overwrite files provided by Steam (e.g. addons, configs, maps) without rebuilding the image:
```bash
-v ./overlay:/opt/overlay
```
See [hackebein/docker-srcds: Overlay folder](https://github.com/Hackebein/docker-srcds#overlay-folder) for details.
## Further Configuration
This image inherits all environment variables and options from the parent image. See [hackebein/docker-srcds](https://github.com/Hackebein/docker-srcds) for the full list of available configuration options.
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
SERVERDIR="/home/steam/unturned/Servers/${INSTANCEID}/Server"
mkdir -p "${SERVERDIR}"
cat > "${SERVERDIR}/Commands.dat" <<EOF
ServerName "${SERVERNAME}"
ServerPassword "${SERVERPASSWORD}"
ServerPasswordAdmin "${ADMINPASSWORD}"
Owner ${OWNER}
Map "${MAP}"
MaxPlayers ${MAXPLAYERS}
Perspective ${PERSPECTIVE}
PVP ${PVP}
Port ${PORT}
VAC ${VAC}
EasyAntiCheat ${EASYANTICHEAT}
EOF
if [ -n "${WORKSHOP}" ]; then
echo "Workshop ${WORKSHOP}" >> "${SERVERDIR}/Commands.dat"
fi
cd /home/steam/unturned
exec ./Unturned_Headless.x86_64 -batchmode -nographics -nolog +InstanceId="${INSTANCEID}" ${CUSTOMPARAMETERS}