diff --git a/Dockerfile b/Dockerfile index 73f4bcd..029493c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -122,8 +122,6 @@ RUN rm -rf /tmp/* # Add default configs COPY config $CONFIG_DIR -COPY config/server.xml $CATALINA_HOME/conf/server.xml - # Apply CIS Apache tomcat recommendations regarding server information # * Alter the advertised server.info String (2.1 - 2.3) RUN cd $CATALINA_HOME/lib \ diff --git a/startup.sh b/startup.sh index d148115..79f951b 100755 --- a/startup.sh +++ b/startup.sh @@ -111,6 +111,16 @@ if [ "${POSTGRES_JNDI_ENABLED}" = "true" ]; then fi fi +# Use a custom "server.xml" if the user mounted one into the container +if [ -d "${CONFIG_OVERRIDES_DIR}" ] && [ -f "${CONFIG_OVERRIDES_DIR}/server.xml" ]; then + echo "Installing configuration override for server.xml with substituted environment variables" + envsubst < "${CONFIG_OVERRIDES_DIR}"/server.xml > "${CATALINA_HOME}/conf/server.xml" +else + # Otherwise use the default + echo "Installing default server.xml with substituted environment variables" + envsubst < "${CONFIG_DIR}"/server.xml > "${CATALINA_HOME}/conf/server.xml" +fi + # start the tomcat # CIS - Tomcat Benchmark recommendations: # * Turn off session facade recycling