Dockerfile now has an entrypoint that overrides configs from private repos to use the correct node/DB connections and full debug mode to servercommon.cfg

This commit is contained in:
Calabro, Brandon
2025-07-20 23:39:58 -05:00
parent 260c39f543
commit 7c7911ba44
2 changed files with 75 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ RUN apt-get install -y \
ant \
bison \
cmake \
dos2unix \
flex \
g++-multilib \
gcc-multilib \
@@ -42,6 +43,15 @@ RUN alien -i --target=amd64 oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.i386.r
RUN rm -f oracle-instantclient18.3-*-18.3.0.0.0-1.i386.rpm
# === START: ORACLE CONFIGURATION FIX ===
# Create a directory for Oracle configuration files
RUN mkdir -p /etc/oracle
# Create sqlnet.ora to enable the EZCONNECT naming method
RUN echo 'NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)' > /etc/oracle/sqlnet.ora
# Tell the Oracle client where to find the configuration
ENV TNS_ADMIN=/etc/oracle
# === END: ORACLE CONFIGURATION FIX ===
ENV ORACLE_HOME=/usr/lib/oracle/18.3/client
ENV LD_LIBRARY_PATH=/usr/lib/oracle/18.3/client/lib:/usr/include/oracle/18.3/client
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-i386
@@ -72,4 +82,12 @@ RUN ant git_update_submods
RUN echo "db_service = FREEPDB1" > local.properties && \
echo "dbip = oracle" >> local.properties
# Copy the entrypoint script, convert its line endings, and make it executable
COPY entrypoint.sh /usr/local/bin/
RUN dos2unix /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# The original command now runs via the entrypoint script
CMD ["/usr/bin/supervisord", "-n"]

57
entrypoint.sh Normal file
View File

@@ -0,0 +1,57 @@
#!/bin/sh
# entrypoint.sh
# Get the container's own IP address at runtime
CONTAINER_IP=$(hostname -i)
# Define the path to the configuration file
CONFIG_FILE="/swg-main/exe/linux/servercommon.cfg"
# Define unique markers for the beginning and end of our configuration block
START_MARKER="# BEGIN DOCKER-MANAGED CONFIG"
END_MARKER="# END DOCKER-MANAGED CONFIG"
# 1. Remove the entire block from the start marker to the end marker.
# The -i flag modifies the file in-place.
# On the first run, this command will do nothing if the markers don't exist, which is fine.
sed -i "/${START_MARKER}/,/${END_MARKER}/d" ${CONFIG_FILE}
# 2. Now, append the new, updated configuration block, including the markers.
cat <<EOF >> ${CONFIG_FILE}
${START_MARKER}
# This block is automatically managed by the container's entrypoint script.
# Do not edit it manually, as changes will be overwritten on container restart.
[dbProcess]
DSN=DBSERVICE
databaseUID=DBUSERNAME
centralServerAddress=${CONTAINER_IP}
[LoginServer]
DSN=DBSERVICE
databaseUID=DBUSERNAME
developmentMode=true
useExternalAuth=true
[CentralServer]
developmentMode=true
[ChatServer]
centralServerAddress=${CONTAINER_IP}
[GameServer]
centralServerAddress=${CONTAINER_IP}
adminGodToAll=1
adminGodToAllGodLevel=50
debugMode=1
[TaskManager]
loginServerAddress=${CONTAINER_IP}
node0=${CONTAINER_IP}
environmentVariable=PATH+=/usr/lib/jvm/java-11-openjdk-i386/bin:./
environmentVariable=LD_LIBRARY_PATH+=/usr/lib/jvm/java-11-openjdk-i386/lib:/usr/lib/jvm/java-11-openjdk-i386/lib/server:./
${END_MARKER}
EOF
# This command executes the original CMD from the Dockerfile
exec "$@"