From c59d0b128af26673c03053f4ee3b72c6b6c72998 Mon Sep 17 00:00:00 2001 From: Bitnami Containers Date: Tue, 5 Mar 2024 14:07:18 +0000 Subject: [PATCH] [bitnami/opencart] Release 4.0.2-3-debian-12-r21 Signed-off-by: Bitnami Containers --- bitnami/opencart/4/debian-12/Dockerfile | 4 ++-- .../4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh | 1 + .../rootfs/opt/bitnami/scripts/apache/entrypoint.sh | 6 ++++++ .../rootfs/opt/bitnami/scripts/apache/postunpack.sh | 6 +++++- .../4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh | 7 +++++++ .../4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh | 5 +++++ .../4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh | 1 + .../debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh | 6 +++++- 8 files changed, 32 insertions(+), 4 deletions(-) diff --git a/bitnami/opencart/4/debian-12/Dockerfile b/bitnami/opencart/4/debian-12/Dockerfile index de2428553616b..d2a86e237001a 100644 --- a/bitnami/opencart/4/debian-12/Dockerfile +++ b/bitnami/opencart/4/debian-12/Dockerfile @@ -7,10 +7,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-23T08:16:25Z" \ + org.opencontainers.image.created="2024-03-05T13:13:36Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="4.0.2-3-debian-12-r20" \ + org.opencontainers.image.ref.name="4.0.2-3-debian-12-r21" \ org.opencontainers.image.title="opencart" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="4.0.2-3" diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh index 449481062e54d..a0c905a9bdcb8 100644 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache-env.sh @@ -48,6 +48,7 @@ export WEB_SERVER_TYPE="apache" export APACHE_BASE_DIR="${BITNAMI_ROOT_DIR}/apache" export APACHE_BIN_DIR="${APACHE_BASE_DIR}/bin" export APACHE_CONF_DIR="${APACHE_BASE_DIR}/conf" +export APACHE_DEFAULT_CONF_DIR="${APACHE_BASE_DIR}/conf.default" export APACHE_HTDOCS_DIR="${APACHE_BASE_DIR}/htdocs" export APACHE_TMP_DIR="${APACHE_BASE_DIR}/var/run" export APACHE_LOGS_DIR="${APACHE_BASE_DIR}/logs" diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh index dad82feba3894..ea643ca0914f0 100755 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/entrypoint.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/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/apache/conf) +debug "Copying files from $APACHE_DEFAULT_CONF_DIR to $APACHE_CONF_DIR" +cp -nr "$APACHE_DEFAULT_CONF_DIR"/. "$APACHE_CONF_DIR" + if [[ "$*" == *"/opt/bitnami/scripts/apache/run.sh"* ]]; then info "** Starting Apache setup **" /opt/bitnami/scripts/apache/setup.sh diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh index 6a480ad4ddde9..3ea96864d6c0c 100755 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/postunpack.sh @@ -109,7 +109,7 @@ EOF apache_setup_bitnami_config # Ensure non-root user has write permissions on a set of directories -for dir in "$APACHE_TMP_DIR" "$APACHE_CONF_DIR" "$APACHE_LOGS_DIR" "$APACHE_VHOSTS_DIR" "$APACHE_HTACCESS_DIR" "$APACHE_HTDOCS_DIR"; do +for dir in "$APACHE_TMP_DIR" "$APACHE_CONF_DIR" "$APACHE_LOGS_DIR" "$APACHE_VHOSTS_DIR" "$APACHE_HTACCESS_DIR" "$APACHE_HTDOCS_DIR" "$APACHE_DEFAULT_CONF_DIR"; do ensure_dir_exists "$dir" chmod -R g+rwX "$dir" done @@ -125,3 +125,7 @@ ln -sf "/dev/stderr" "${APACHE_LOGS_DIR}/error_log" # Source: https://stackoverflow.com/questions/94445/using-openssl-what-does-unable-to-write-random-state-mean touch /.rnd && chmod g+rw /.rnd + +# Copy all initially generated configuration files to the default directory +# (this is to avoid breaking when entrypoint is being overridden) +cp -r "$APACHE_CONF_DIR"/* "$APACHE_DEFAULT_CONF_DIR" diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh index ab451b6c1442e..9c758d084f958 100755 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/apache/setup.sh @@ -10,6 +10,7 @@ set -o pipefail # set -o xtrace # Uncomment this line for debugging purposes # Load libraries +. /opt/bitnami/scripts/libfs.sh . /opt/bitnami/scripts/liblog.sh . /opt/bitnami/scripts/libapache.sh @@ -22,6 +23,12 @@ apache_validate # Ensure Apache daemon user exists when running as 'root' am_i_root && ensure_user_exists "$APACHE_DAEMON_USER" --group "$APACHE_DAEMON_GROUP" +if ! is_dir_empty "$APACHE_DEFAULT_CONF_DIR"; then + # We add the copy from default config in the initialize function for web applications + # that make use of the Apache setup.sh script + debug "Copying files from $APACHE_DEFAULT_CONF_DIR to $APACHE_CONF_DIR" + cp -nr "$APACHE_DEFAULT_CONF_DIR"/. "$APACHE_CONF_DIR" +fi # Generate SSL certs (without a passphrase) ensure_dir_exists "${APACHE_CONF_DIR}/bitnami/certs" if [[ ! -f "${APACHE_CONF_DIR}/bitnami/certs/server.crt" ]]; then diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh index a107519847f50..369f5ae6b3346 100644 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/libphp.sh @@ -59,8 +59,13 @@ php_conf_set() { php_initialize() { # Configure PHP options based on the runtime environment info "Configuring PHP options" + if ! is_dir_empty "$PHP_DEFAULT_CONF_DIR"; then + # Copy default configuration to php configuration directory + cp -nr "$PHP_DEFAULT_CONF_DIR"/. "$PHP_CONF_DIR" + fi php_set_runtime_config "$PHP_CONF_FILE" + # PHP-FPM configuration ! is_empty_value "$PHP_FPM_LISTEN_ADDRESS" && info "Setting PHP-FPM listen option" && php_conf_set "listen" "$PHP_FPM_LISTEN_ADDRESS" "${PHP_CONF_DIR}/php-fpm.d/www.conf" diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh index 97043106ecb52..669690619be60 100644 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php-env.sh @@ -52,6 +52,7 @@ unset php_env_vars export PHP_BASE_DIR="${BITNAMI_ROOT_DIR}/php" export PHP_BIN_DIR="${PHP_BASE_DIR}/bin" export PHP_CONF_DIR="${PHP_BASE_DIR}/etc" +export PHP_DEFAULT_CONF_DIR="${PHP_BASE_DIR}/etc.default" export PHP_TMP_DIR="${PHP_BASE_DIR}/var/run" export PHP_CONF_FILE="${PHP_CONF_DIR}/php.ini" diff --git a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh index 9a8b9fe2bcd95..762772bf9e108 100755 --- a/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh +++ b/bitnami/opencart/4/debian-12/rootfs/opt/bitnami/scripts/php/postunpack.sh @@ -29,7 +29,7 @@ php_conf_set "upload_tmp_dir" "${PHP_BASE_DIR}/tmp" php_conf_set "session.save_path" "${PHP_TMP_DIR}/session" # Ensure directories used by PHP-FPM exist and have proper ownership and permissions -for dir in "$PHP_CONF_DIR" "${PHP_BASE_DIR}/tmp" "$PHP_TMP_DIR" "$PHP_FPM_LOGS_DIR" "${PHP_TMP_DIR}/session"; do +for dir in "$PHP_CONF_DIR" "$PHP_DEFAULT_CONF_DIR" "${PHP_BASE_DIR}/tmp" "$PHP_TMP_DIR" "$PHP_FPM_LOGS_DIR" "${PHP_TMP_DIR}/session"; do ensure_dir_exists "$dir" chmod -R g+rwX "$dir" done @@ -41,3 +41,7 @@ touch "${PHP_CONF_DIR}/common.conf" # Log to stdout/stderr for easy debugging ln -sf "/dev/stdout" "$PHP_FPM_LOG_FILE" php_conf_set "error_log" "/dev/stderr" + +# Copy all initially generated configuration files to the default directory +# (this is to avoid breaking when entrypoint is being overridden) +cp -r "$PHP_CONF_DIR"/* "$PHP_DEFAULT_CONF_DIR"