feat: Allow specifying server version via manifest ID

This commit is contained in:
Mikolaj Wojciech Gorski 2025-07-24 23:11:23 +02:00
parent c41b3ed134
commit 2355f6f9cc
4 changed files with 68 additions and 5 deletions

View file

@ -11,6 +11,11 @@ ENV GID=1000
# Default timezone is UTC # Default timezone is UTC
ENV TZ=Etc/UTC ENV TZ=Etc/UTC
# Set the Depot ID for the server
ENV DEPOT_ID=996562
# Set a specific manifest ID to download an older version of the server, defaults to latest version
ENV MANIFEST_ID=7306793446776857728
# Install dependencies # Install dependencies
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y libicu-dev gosu && \ apt-get install -y libicu-dev gosu && \
@ -28,4 +33,4 @@ COPY start.sh /start.sh
RUN chmod +x /start.sh RUN chmod +x /start.sh
# User will be created at runtime based on ENV values # User will be created at runtime based on ENV values
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]

View file

@ -1,6 +1,6 @@
# SCP: Secret Laboratory Docker Server # SCP: Secret Laboratory Docker Server
A Docker container for easily running an SCP: Secret Laboratory dedicated server. A Docker container for easily running an SCP: Secret Laboratory dedicated server made by (Matthew Green)[https://git.matthewgreen.gg/mgreen/scp-secret-laboratory-server-docker] and slightly modified by me to add an option to select the manifest version.
## Quick Start ## Quick Start
@ -23,6 +23,9 @@ services:
- GID=1000 - GID=1000
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). # To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
# - TZ=Etc/UTC # - TZ=Etc/UTC
# To use a specific server version, uncomment the next line and set a manifest ID.
# See the "Using an Older Server Version" section for details.
# - MANIFEST_ID=none
restart: unless-stopped restart: unless-stopped
``` ```
@ -59,6 +62,9 @@ docker run -d \
-e GID=1000 \ -e GID=1000 \
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). # To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
# -e TZ=Etc/UTC \ # -e TZ=Etc/UTC \
# To use a specific server version, uncomment the next line and set a manifest ID.
# See the "Using an Older Server Version" section for details.
# -e MANIFEST_ID=none \
--restart unless-stopped \ --restart unless-stopped \
greenmatthew/scp-secret-laboratory-server:latest greenmatthew/scp-secret-laboratory-server:latest
``` ```
@ -79,6 +85,18 @@ Mounting the .config directory allows you to configure any server setting and ha
- `UID`: User ID to run the server as (default: 1000) - `UID`: User ID to run the server as (default: 1000)
- `GID`: Group ID to run the server as (default: 1000) - `GID`: Group ID to run the server as (default: 1000)
- `TZ`: [Timezone identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) for the container (default: Etc/UTC). Examples: `America/Chicago`, `Europe/London`, `Asia/Tokyo` - `TZ`: [Timezone identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) for the container (default: Etc/UTC). Examples: `America/Chicago`, `Europe/London`, `Asia/Tokyo`
- `DEPOT_ID`: The Steam Depot ID for the server files (default: `996562`). This generally should not be changed.
- `MANIFEST_ID`: The Steam Manifest ID for a specific server version (default: `none`). See the "Using an Older Server Version" section for details.
## Using an Older Server Version
You can run an older version of the SCP:SL dedicated server by specifying a manifest ID. This is useful for compatibility with certain mods or for playing on a specific game version.
You can find a list of available manifest IDs on SteamDB. Note that you may need to be logged into Steam (e.g. via the SteamDB browser extension) to see the full list of historical manifests.
[`https://steamdb.info/depot/996562/manifests/`](https://steamdb.info/depot/996562/manifests/)
Once you have a manifest ID, set it using the `MANIFEST_ID` environment variable. When the container starts, it will download and run the server version corresponding to the specified manifest ID. To go back to the latest version, simply remove the `MANIFEST_ID` environment variable or set it back to `none`.
## Port Configuration ## Port Configuration
@ -112,4 +130,4 @@ make help
## License ## License
Released under the MIT License. See [LICENSE](LICENSE) file for details. Released under the MIT License. See [LICENSE](LICENSE) file for details.

18
compose.yaml Normal file
View file

@ -0,0 +1,18 @@
services:
scp-sl-server:
build:
context: .
dockerfile: Dockerfile
container_name: scp-sl-server
ports:
- "7777:7777/udp"
volumes:
- ./config:/home/steam/.config
environment:
- UID=1000
- GID=1000
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
# - TZ=Etc/UTC
# To download a specific version of the server, uncomment the next line and set the value to a valid manifest ID.
# - MANIFEST_ID=none
restart: unless-stopped

View file

@ -4,7 +4,29 @@ set -e
echo "Current user is: $(whoami)" echo "Current user is: $(whoami)"
# Install/update SCP:SL server # Install/update SCP:SL server
steamcmd +force_install_dir $SERVER_DIR +login anonymous +app_update 996560 validate +quit if [ "$MANIFEST_ID" = "none" ]; then
echo "MANIFEST_ID not set, downloading latest server version..."
steamcmd +force_install_dir $SERVER_DIR +login anonymous +app_update 996560 validate +quit
else
echo "MANIFEST_ID set to $MANIFEST_ID, downloading specific server version..."
# download_depot downloads to a specific folder, not the one specified by force_install_dir
# It will be downloaded to <install_dir>/steamapps/content/app_<id>/depot_<id>
steamcmd +login anonymous +download_depot 996560 $DEPOT_ID $MANIFEST_ID +quit
DEPOT_DOWNLOAD_DIR="$INSTALL_DIR/steamapps/content/app_996560/depot_$DEPOT_ID"
if [ -d "$DEPOT_DOWNLOAD_DIR" ] && [ "$(ls -A "$DEPOT_DOWNLOAD_DIR")" ]; then
echo "Depot downloaded successfully. Clearing server directory..."
find "$SERVER_DIR" -mindepth 1 -delete
echo "Copying downloaded files from $DEPOT_DOWNLOAD_DIR to $SERVER_DIR"
cp -rT "$DEPOT_DOWNLOAD_DIR" "$SERVER_DIR"
echo "Successfully copied files."
else
echo "Error: Depot download failed or the directory is empty." >&2
echo "Please check MANIFEST_ID ($MANIFEST_ID) and DEPOT_ID ($DEPOT_ID)" >&2
exit 1
fi
fi
# Ensure config directory exists # Ensure config directory exists
INTERNAL_CONFIG_SUBDIR="$CONFIG_DIR/SCP Secret Laboratory/config/" INTERNAL_CONFIG_SUBDIR="$CONFIG_DIR/SCP Secret Laboratory/config/"
@ -26,4 +48,4 @@ fi
# Run server # Run server
cd $SERVER_DIR && HOME=$INSTALL_DIR ./LocalAdmin $PORT cd $SERVER_DIR && HOME=$INSTALL_DIR ./LocalAdmin $PORT
sleep infinity sleep infinity