diff --git a/bitnami/tomcat/10.1/debian-12/Dockerfile b/bitnami/tomcat/10.1/debian-12/Dockerfile index b0af6ac1602a..76a20e00b0cd 100644 --- a/bitnami/tomcat/10.1/debian-12/Dockerfile +++ b/bitnami/tomcat/10.1/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-22T08:15:15Z" \ + org.opencontainers.image.created="2024-02-29T17:25:56Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="10.1.19-debian-12-r0" \ + org.opencontainers.image.ref.name="10.1.19-debian-12-r1" \ org.opencontainers.image.title="tomcat" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="10.1.19" diff --git a/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh b/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh index 84b976ca9d64..2050bf07d4f3 100644 --- a/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat-env.sh +++ b/bitnami/tomcat/10.1/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/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh b/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh index d32145f126e5..4f5948b8b6f7 100755 --- a/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/entrypoint.sh +++ b/bitnami/tomcat/10.1/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/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh b/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh index fc9fd90c6926..fa5ee033d925 100755 --- a/bitnami/tomcat/10.1/debian-12/rootfs/opt/bitnami/scripts/tomcat/postunpack.sh +++ b/bitnami/tomcat/10.1/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" diff --git a/bitnami/tomcat/README.md b/bitnami/tomcat/README.md index 86c4a883ab1e..40a463d3c4cd 100644 --- a/bitnami/tomcat/README.md +++ b/bitnami/tomcat/README.md @@ -158,25 +158,26 @@ Access your web server in the browser by navigating to `http://localhost:8080`. #### Read-only environment variables -| Name | Description | Value | -|--------------------------|----------------------------------------------------|---------------------------------------| -| `TOMCAT_BASE_DIR` | Tomcat installation directory. | `${BITNAMI_ROOT_DIR}/tomcat` | -| `TOMCAT_VOLUME_DIR` | Tomcat persistence directory. | `/bitnami/tomcat` | -| `TOMCAT_BIN_DIR` | Tomcat directory for binary files. | `${TOMCAT_BASE_DIR}/bin` | -| `TOMCAT_LIB_DIR` | Tomcat directory for library files. | `${TOMCAT_BASE_DIR}/lib` | -| `TOMCAT_WORK_DIR` | Tomcat directory for runtime files. | `${TOMCAT_BASE_DIR}/work` | -| `TOMCAT_WEBAPPS_DIR` | Tomcat directory where webapps are stored. | `${TOMCAT_VOLUME_DIR}/webapps` | -| `TOMCAT_CONF_DIR` | Tomcat configuration directory. | `${TOMCAT_BASE_DIR}/conf` | -| `TOMCAT_CONF_FILE` | Tomcat configuration file. | `${TOMCAT_CONF_DIR}/server.xml` | -| `TOMCAT_USERS_CONF_FILE` | Tomcat configuration file. | `${TOMCAT_CONF_DIR}/tomcat-users.xml` | -| `TOMCAT_LOGS_DIR` | Directory where Tomcat logs are stored. | `${TOMCAT_BASE_DIR}/logs` | -| `TOMCAT_TMP_DIR` | Directory where Tomcat temporary files are stored. | `${TOMCAT_BASE_DIR}/temp` | -| `TOMCAT_LOG_FILE` | Path to the log file for Tomcat. | `${TOMCAT_LOGS_DIR}/catalina.out` | -| `TOMCAT_PID_FILE` | Path to the PID file for Tomcat. | `${TOMCAT_TMP_DIR}/catalina.pid` | -| `TOMCAT_HOME` | Tomcat home directory. | `$TOMCAT_BASE_DIR` | -| `TOMCAT_DAEMON_USER` | Tomcat system user. | `tomcat` | -| `TOMCAT_DAEMON_GROUP` | Tomcat system group. | `tomcat` | -| `JAVA_HOME` | Java installation folder. | `${BITNAMI_ROOT_DIR}/java` | +| Name | Description | Value | +|---------------------------|----------------------------------------------------|---------------------------------------| +| `TOMCAT_BASE_DIR` | Tomcat installation directory. | `${BITNAMI_ROOT_DIR}/tomcat` | +| `TOMCAT_VOLUME_DIR` | Tomcat persistence directory. | `/bitnami/tomcat` | +| `TOMCAT_BIN_DIR` | Tomcat directory for binary files. | `${TOMCAT_BASE_DIR}/bin` | +| `TOMCAT_LIB_DIR` | Tomcat directory for library files. | `${TOMCAT_BASE_DIR}/lib` | +| `TOMCAT_WORK_DIR` | Tomcat directory for runtime files. | `${TOMCAT_BASE_DIR}/work` | +| `TOMCAT_WEBAPPS_DIR` | Tomcat directory where webapps are stored. | `${TOMCAT_VOLUME_DIR}/webapps` | +| `TOMCAT_CONF_DIR` | Tomcat configuration directory. | `${TOMCAT_BASE_DIR}/conf` | +| `TOMCAT_DEFAULT_CONF_DIR` | Tomcat default configuration directory. | `${TOMCAT_BASE_DIR}/conf.default` | +| `TOMCAT_CONF_FILE` | Tomcat configuration file. | `${TOMCAT_CONF_DIR}/server.xml` | +| `TOMCAT_USERS_CONF_FILE` | Tomcat configuration file. | `${TOMCAT_CONF_DIR}/tomcat-users.xml` | +| `TOMCAT_LOGS_DIR` | Directory where Tomcat logs are stored. | `${TOMCAT_BASE_DIR}/logs` | +| `TOMCAT_TMP_DIR` | Directory where Tomcat temporary files are stored. | `${TOMCAT_BASE_DIR}/temp` | +| `TOMCAT_LOG_FILE` | Path to the log file for Tomcat. | `${TOMCAT_LOGS_DIR}/catalina.out` | +| `TOMCAT_PID_FILE` | Path to the PID file for Tomcat. | `${TOMCAT_TMP_DIR}/catalina.pid` | +| `TOMCAT_HOME` | Tomcat home directory. | `$TOMCAT_BASE_DIR` | +| `TOMCAT_DAEMON_USER` | Tomcat system user. | `tomcat` | +| `TOMCAT_DAEMON_GROUP` | Tomcat system group. | `tomcat` | +| `JAVA_HOME` | Java installation folder. | `${BITNAMI_ROOT_DIR}/java` | #### Creating a custom user