Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

RUN dpkg --add-architecture i386 && \
apt-get update && \
echo steam steam/question select "I AGREE" | debconf-set-selections && \
echo steam steam/license note '' | debconf-set-selections && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wine64 steamcmd && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wine64 steamcmd curl dos2unix && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

ENV PATH="$PATH:/usr/games"
ENV UsePerfThreads=true
ENV NoAsyncLoadingThread=true
ENV AutoUpdate=true

WORKDIR /steamcmd

COPY ./entrypoint.sh /entrypoint.sh
RUN dos2unix /entrypoint.sh
ENTRYPOINT ["bash", "/entrypoint.sh"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
For operating a dedicated server in Docker in order to use it under Linux.
The container uses Wine to run the server under Linux.

## NEW - Added Discord Webhook Integration for Session Code

- Added discord webhook integration via container environment variable to spit out the invite code to any text channel you'd like.
- Add the environment variable "DISCORD_WEBHOOK_URL" and give it the webhook URL from the discord text channel you want it posted in.
- See [`docker-compose.yml.example`](docker-compose.yml.example) for an example.

## Setup
1. Create a new empty directory in any location with enough storage space.
2. Create a file named `docker-compose.yml` and copy the content of [`docker-compose.yml.example`](docker-compose.yml.example) into it.
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
abiotic-server:
image: "ghcr.io/pleut/abiotic-factor-linux-docker:latest"
image: "thisismynameok/abiotic-factor-linux-docker:latest"
restart: unless-stopped
volumes:
- "./gamefiles:/server"
Expand All @@ -16,6 +16,7 @@ services:
- WorldSaveName=Cascade
# - AutoUpdate=true
# - AdditionalArgs=-SandboxIniPath=Config/WindowsServer/Server1Sandbox.ini
- DISCORD_WEBOOK_URL: <discord webhook url here>
ports:
- "0.0.0.0:7777:7777/udp"
- "0.0.0.0:27015:27015/udp"
48 changes: 40 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash
set -euo pipefail

# Configure server arguments
SetUsePerfThreads="-useperfthreads "
if [[ $UsePerfThreads == "false" ]]; then
SetUsePerfThreads=""
Expand All @@ -16,18 +20,46 @@ SteamServerName="${SteamServerName:-LinuxServer}"
WorldSaveName="${WorldSaveName:-Cascade}"
AdditionalArgs="${AdditionalArgs:-}"

# The Discord webhook URL is provided as an environment variable.
# If not provided, the game server still starts but without webhook integration.
DISCORD_WEBHOOK_URL="${DISCORD_WEBHOOK_URL:-}"

# Check for updates/perform initial installation
if [ ! -d "/server/AbioticFactor/Binaries/Win64" ] || [[ $AutoUpdate == "true" ]]; then
steamcmd \
+@sSteamCmdForcePlatformType windows \
+force_install_dir /server \
+login anonymous \
+app_update 2857200 validate \
+quit
+@sSteamCmdForcePlatformType windows \
+force_install_dir /server \
+login anonymous \
+app_update 2857200 validate \
+quit
fi

pushd /server/AbioticFactor/Binaries/Win64 > /dev/null
wine AbioticFactorServer-Win64-Shipping.exe $SetUsePerfThreads$SetNoAsyncLoadingThread-MaxServerPlayers=$MaxServerPlayers \
-PORT=$Port -QueryPort=$QueryPort -ServerPassword=$ServerPassword \
-SteamServerName="$SteamServerName" -WorldSaveName="$WorldSaveName" -tcp $AdditionalArgs

echo "Starting game server..."
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
echo "Discord webhook URL not provided; server will run without webhook notifications."
wine AbioticFactorServer-Win64-Shipping.exe ${SetUsePerfThreads}${SetNoAsyncLoadingThread}-MaxServerPlayers=${MaxServerPlayers} \
-PORT=${Port} -QueryPort=${QueryPort} -ServerPassword=${ServerPassword} \
-SteamServerName="${SteamServerName}" -WorldSaveName="${WorldSaveName}" -tcp ${AdditionalArgs}
else
echo "Discord webhook enabled; monitoring logs for join code..."
# Run the game server, piping output to tee which both prints the log and sends it to the notifier.
wine AbioticFactorServer-Win64-Shipping.exe ${SetUsePerfThreads}${SetNoAsyncLoadingThread}-MaxServerPlayers=${MaxServerPlayers} \
-PORT=${Port} -QueryPort=${QueryPort} -ServerPassword=${ServerPassword} \
-SteamServerName="${SteamServerName}" -WorldSaveName="${WorldSaveName}" -tcp ${AdditionalArgs} \
| tee >(while IFS= read -r line; do
# Forward the line to stdout
echo "$line"
# Look for the join code line – adjust this regex if needed.
if echo "$line" | grep -q "Session short code:"; then
join_code=$(echo "$line" | sed -n 's/.*Session short code: \([A-Z0-9]\+\).*/\1/p')
# Send only the join code to Discord via webhook
curl -H "Content-Type: application/json" \
-d "{\"content\": \"${join_code}\"}" \
"$DISCORD_WEBHOOK_URL"
fi
done)
fi

popd > /dev/null