Allow custom game ports other than 12203 to be specified through GAME_PORT environment variable

This commit is contained in:
smallmodel 2024-12-17 19:29:17 +01:00
parent 1be50cdddf
commit 6b36bec8e9
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
3 changed files with 11 additions and 2 deletions

View file

@ -37,5 +37,9 @@ HEALTHCHECK --interval=15s --timeout=20s --start-period=10s --retries=3 CMD [ "b
RUN useradd -m openmohaa RUN useradd -m openmohaa
USER openmohaa USER openmohaa
ENV GAME_PORT=12203
COPY "entrypoint.sh" "/usr/local/bin/entrypoint.sh"
WORKDIR "/usr/local/share/mohaa" WORKDIR "/usr/local/share/mohaa"
ENTRYPOINT [ "/usr/local/games/openmohaa/lib/openmohaa/omohaaded", "+set", "fs_homepath", "home" ]
ENTRYPOINT [ "bash", "entrypoint.sh" ]

View file

@ -0,0 +1,5 @@
#!/bin/bash
# It's amazing that with Docker, one can't put environment variables in the array of the ENTRYPOINT command
/usr/local/games/openmohaa/lib/openmohaa/omohaaded +set fs_homepath home +set dedicated 2 +set net_port $GAME_PORT:-12203 $@

View file

@ -6,7 +6,7 @@ header=$'\xff\xff\xff\xff\x01disconnect'
# so the server will return the disconnect message # so the server will return the disconnect message
message=$'none' message=$'none'
query_port=12203 query_port=${GAME_PORT:-12203}
data="" data=""
while [ -z "$data" ] while [ -z "$data" ]