Files
adventureland/docker/entrypoint.sh
T
2026-10-29 21:13:01 +01:00

19 lines
675 B
Bash
Executable File

#!/bin/sh
# Container entrypoint.
#
# The backend talks to game servers through the address that is advertised to
# browsers (servers.<key>.address, e.g. localhost:7192). Inside the backend
# container "localhost" is the container itself, not the game container, so
# with AL_GAME_RELAY=1 a small TCP forwarder publishes the game port on
# 127.0.0.1 for the backend only.
set -eu
if [ "${AL_GAME_RELAY:-0}" = "1" ]; then
GAME_HOST="${AL_GAME_HOST:-al-game}"
GAME_PORT="${AL_GAME_PORT:-7192}"
echo "Relaying 127.0.0.1:${GAME_PORT} -> ${GAME_HOST}:${GAME_PORT}"
socat "TCP-LISTEN:${GAME_PORT},fork,reuseaddr,bind=127.0.0.1" "TCP:${GAME_HOST}:${GAME_PORT}" &
fi
exec "$@"