diff --git a/bitnami/tomcat/8.5/debian-12/Dockerfile b/bitnami/tomcat/8.5/debian-12/Dockerfile index b968f06ba721..f6ab2cdc416f 100644 --- a/bitnami/tomcat/8.5/debian-12/Dockerfile +++ b/bitnami/tomcat/8.5/debian-12/Dockerfile @@ -8,10 +8,10 @@ ARG TARGETARCH LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-02-22T05:52:07Z" \ + org.opencontainers.image.created="2024-02-29T18:02:46Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="8.5.99-debian-12-r0" \ + org.opencontainers.image.ref.name="8.5.99-debian-12-r1" \ org.opencontainers.image.title="tomcat" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="8.5.99" diff --git a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh index 84b976ca9d64..2050bf07d4f3 100644 --- a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh +++ b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh @@ -58,6 +58,7 @@ export TOMCAT_LIB_DIR="${TOMCAT_BASE_DIR}/lib" export TOMCAT_WORK_DIR="${TOMCAT_BASE_DIR}/work" export TOMCAT_WEBAPPS_DIR="${TOMCAT_VOLUME_DIR}/webapps" export TOMCAT_CONF_DIR="${TOMCAT_BASE_DIR}/conf" +export TOMCAT_DEFAULT_CONF_DIR="${TOMCAT_BASE_DIR}/conf.default" export TOMCAT_CONF_FILE="${TOMCAT_CONF_DIR}/server.xml" export TOMCAT_USERS_CONF_FILE="${TOMCAT_CONF_DIR}/tomcat-users.xml" export TOMCAT_LOGS_DIR="${TOMCAT_BASE_DIR}/logs" diff --git a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh index d32145f126e5..4f5948b8b6f7 100755 --- a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh +++ b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh @@ -19,6 +19,12 @@ set -o pipefail print_welcome_page +# We add the copy from default config in the entrypoint to not break users +# bypassing the setup.sh logic. If the file already exists do not overwrite (in +# case someone mounts a configuration file in /opt/bitnami/tomcat/conf) +debug "Copying files from $TOMCAT_DEFAULT_CONF_DIR to $TOMCAT_CONF_DIR" +cp -nr "$TOMCAT_DEFAULT_CONF_DIR"/. "$TOMCAT_CONF_DIR" + if [[ "$*" = *"/opt/bitnami/scripts/tomcat/run.sh"* ]]; then info "** Starting tomcat setup **" /opt/bitnami/scripts/tomcat/setup.sh diff --git a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh index fc9fd90c6926..fa5ee033d925 100755 --- a/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh +++ b/bitnami/tomcat/8.5/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh @@ -28,7 +28,7 @@ chmod g+rwX "$TOMCAT_HOME" # Make TOMCAT_LIB_DIR writable (non-recursively, for security reasons) for non-root approach, some apps may copy files there chmod g+rwX "$TOMCAT_LIB_DIR" # Make required folders writable by the Tomcat web server user -for dir in "$TOMCAT_TMP_DIR" "$TOMCAT_LOGS_DIR" "$TOMCAT_CONF_DIR" "$TOMCAT_WORK_DIR" "$TOMCAT_WEBAPPS_DIR" "${TOMCAT_BASE_DIR}/webapps"; do +for dir in "$TOMCAT_TMP_DIR" "$TOMCAT_LOGS_DIR" "$TOMCAT_CONF_DIR" "$TOMCAT_WORK_DIR" "$TOMCAT_WEBAPPS_DIR" "${TOMCAT_BASE_DIR}/webapps" "$TOMCAT_DEFAULT_CONF_DIR"; do ensure_dir_exists "$dir" # Use tomcat:root ownership for compatibility when running as a non-root user configure_permissions_ownership "$dir" -d "775" -f "664" -u "$TOMCAT_DAEMON_USER" -g "root" @@ -49,3 +49,7 @@ ln -sf tomcat "${BITNAMI_ROOT_DIR}/apache-tomcat" # Users can mount their webapps at /app ln -sf "$TOMCAT_WEBAPPS_DIR" /app + +# Copy all initially generated configuration files to the default directory +# (this is to avoid breaking when entrypoint is being overridden) +cp -r "$TOMCAT_CONF_DIR"/* "$TOMCAT_DEFAULT_CONF_DIR"