diff --git a/bitnami/phpmyadmin/5/debian-10/Dockerfile b/bitnami/phpmyadmin/5/debian-10/Dockerfile index cd6db58d6bfe..8f4792947673 100644 --- a/bitnami/phpmyadmin/5/debian-10/Dockerfile +++ b/bitnami/phpmyadmin/5/debian-10/Dockerfile @@ -9,7 +9,7 @@ ENV HOME="/" \ COPY prebuildfs / # Install required system packages and dependencies RUN install_packages acl ca-certificates curl gzip libaudit1 libbsd0 libbz2-1.0 libc6 libcap-ng0 libcom-err2 libcurl4 libexpat1 libffi6 libfftw3-double3 libfontconfig1 libfreetype6 libgcc1 libgcrypt20 libglib2.0-0 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libhogweed4 libicu63 libidn2-0 libjemalloc2 libjpeg62-turbo libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 liblcms2-2 libldap-2.4-2 liblqr-1-0 libltdl7 liblzma5 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmcrypt4 libmemcached11 libmemcachedutil2 libncurses6 libnettle6 libnghttp2-14 libp11-kit0 libpam0g libpcre3 libpng16-16 libpq5 libpsl5 libreadline7 librtmp1 libsasl2-2 libsqlite3-0 libssh2-1 libssl1.1 libstdc++6 libsybdb5 libtasn1-6 libtidy5deb1 libtinfo6 libunistring2 libuuid1 libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxslt1.1 libzip4 procps tar zlib1g -RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "php" "7.3.19-2" --checksum 25bba77655b298c62ab474954837acbc167a4bcc8555c39b419644c999207c5f +RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "php" "7.3.19-3" --checksum afa209bbdf622ab11b677cd01082acd7f9a190b30e68d5434aced4e69e033dde RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "apache" "2.4.43-5" --checksum e9faded57e3703fe9fcea650eb302e673d969a399fe9dfafa67e173465637665 RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "mysql-client" "10.3.23-1" --checksum efab843077267af6a8cde53440a1fef0acf8cb67ab1dcd0b6da2e9cbe050c7e1 RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "libphp" "7.3.19-2" --checksum c5dddf3ea541f5c0d6f65fa7d743de710de5ec53cdf8458a25c74e70f0c8397d @@ -29,7 +29,7 @@ ENV ALLOW_EMPTY_PASSWORD="no" \ APACHE_HTTPS_PORT_NUMBER="" \ APACHE_HTTP_PORT_NUMBER="" \ BITNAMI_APP_NAME="phpmyadmin" \ - BITNAMI_IMAGE_VERSION="5.0.2-debian-10-r106" \ + BITNAMI_IMAGE_VERSION="5.0.2-debian-10-r107" \ MARIADB_HOST="mariadb" \ MARIADB_PORT_NUMBER="3306" \ MARIADB_ROOT_PASSWORD="" \ diff --git a/bitnami/phpmyadmin/5/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh b/bitnami/phpmyadmin/5/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh index 78c85c5ad384..d74114834f8e 100644 --- a/bitnami/phpmyadmin/5/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh +++ b/bitnami/phpmyadmin/5/debian-10/prebuildfs/opt/bitnami/scripts/libwebserver.sh @@ -150,7 +150,7 @@ web_server_reload() { ######################## ensure_web_server_app_configuration_exists() { local app="${1:?missing app}" - local -a args=() + local -a args=("$app") # Validate arguments shift while [[ "$#" -gt 0 ]]; do @@ -165,7 +165,7 @@ ensure_web_server_app_configuration_exists() { | --https-port \ | --document-root \ ) - args+=("$1" "$2") + args+=("$1" "${2:?missing value}") shift ;; @@ -176,13 +176,13 @@ ensure_web_server_app_configuration_exists() { | --apache-extra-directory-configuration \ | --apache-move-htaccess \ ) - [[ "$(web_server_type)" == "apache" ]] && args+=("${1//apache-/}" "$2") + [[ "$(web_server_type)" == "apache" ]] && args+=("${1//apache-/}" "${2:?missing value}") shift ;; # Specific NGINX flags --nginx-additional-configuration) - [[ "$(web_server_type)" == "nginx" ]] && args+=("${1//nginx-/}" "$2") + [[ "$(web_server_type)" == "nginx" ]] && args+=("${1//nginx-/}" "${2:?missing value}") shift ;; @@ -193,7 +193,7 @@ ensure_web_server_app_configuration_exists() { esac shift done - "ensure_$(web_server_type)_app_configuration_exists" "$app" "${args[@]}" + "ensure_$(web_server_type)_app_configuration_exists" "${args[@]}" } ######################## @@ -235,7 +235,7 @@ ensure_web_server_app_configuration_not_exists() { ######################## ensure_web_server_prefix_configuration_exists() { local app="${1:?missing app}" - local -a args=() + local -a args=("$app") # Validate arguments shift while [[ "$#" -gt 0 ]]; do @@ -246,7 +246,7 @@ ensure_web_server_prefix_configuration_exists() { | --prefix \ | --type \ ) - args+=("$1" "$2") + args+=("$1" "${2:?missing value}") shift ;; @@ -273,7 +273,49 @@ ensure_web_server_prefix_configuration_exists() { esac shift done - "ensure_$(web_server_type)_prefix_configuration_exists" "$app" "${args[@]}" + "ensure_$(web_server_type)_prefix_configuration_exists" "${args[@]}" +} + +######################## +# Ensure a web server application configuration is updated with the runtime configuration (i.e. ports) +# It serves as a wrapper for the specific web server function +# Globals: +# * +# Arguments: +# $1 - App name +# Flags: +# --hosts - Hosts to enable +# --enable-https - Update HTTPS app configuration +# --http-port - HTTP port number +# --https-port - HTTPS port number +# Returns: +# true if the configuration was updated, false otherwise +######################## +web_server_update_app_configuration() { + local app="${1:?missing app}" + local -a args=("$app") + # Validate arguments + shift + while [[ "$#" -gt 0 ]]; do + case "$1" in + # Common flags + --hosts \ + | --enable-https \ + | --http-port \ + | --https-port \ + ) + args+=("$1" "${2:?missing value}") + shift + ;; + + *) + echo "Invalid command line flag $1" >&2 + return 1 + ;; + esac + shift + done + "$(web_server_type)_update_app_configuration" "${args[@]}" } ######################## diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/libapache.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/libapache.sh index aab3d3fa5175..ff262cb594a7 100644 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/libapache.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/libapache.sh @@ -613,3 +613,75 @@ EOF warn "The ${app} web server configuration file '${prefix_file}' is not writable. Configurations based on environment variables will not be applied for this file." fi } + +######################## +# Ensure Apache application configuration is updated with the runtime configuration (i.e. ports) +# Globals: +# * +# Arguments: +# $1 - App name +# Flags: +# --hosts - Hosts to enable +# --enable-https - Update HTTPS app configuration +# --http-port - HTTP port number +# --https-port - HTTPS port number +# Returns: +# true if the configuration was updated, false otherwise +######################## +apache_update_app_configuration() { + local -r app="${1:?missing app}" + # Default options + local -a hosts=("127.0.0.1" "_default_") + local enable_https="yes" + local http_port="${APACHE_HTTP_PORT_NUMBER:-"$APACHE_DEFAULT_HTTP_PORT_NUMBER"}" + local https_port="${APACHE_HTTPS_PORT_NUMBER:-"$APACHE_DEFAULT_HTTPS_PORT_NUMBER"}" + # Validate arguments + shift + while [[ "$#" -gt 0 ]]; do + case "$1" in + --hosts) + shift + read -r -a hosts <<< "$1" + ;; + + # Common flags + --enable-https \ + | --http-port \ + | --https-port \ + ) + args+=("$1" "$2") + shift + ;; + + *) + echo "Invalid command line flag $1" >&2 + return 1 + ;; + esac + shift + done + # Construct host string in the format of "host1:port1[ host2:port2[ ...]]" + export http_listen_addresses="" + export https_listen_addresses="" + for host in "${hosts[@]}"; do + http_listen="${host}:${http_port}" + https_listen="${host}:${https_port}" + [[ -z "${http_listen_addresses:-}" ]] && http_listen_addresses="$http_listen" || http_listen_addresses="${http_listen_addresses} ${http_listen}" + [[ -z "${https_listen_addresses:-}" ]] && https_listen_addresses="$https_listen" || https_listen_addresses="${https_listen_addresses} ${https_listen}" + done + # Update configuration + local -r http_vhost="${APACHE_VHOSTS_DIR}/${app}-vhost.conf" + local -r https_vhost="${APACHE_VHOSTS_DIR}/${app}-https-vhost.conf" + if is_file_writable "$http_vhost"; then + replace_in_file "$http_vhost" "^$" "" + else + warn "The ${app} virtual host file '${http_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." + fi + if is_boolean_yes "$enable_https"; then + if is_file_writable "$https_vhost"; then + replace_in_file "$https_vhost" "^$" "" + else + warn "The ${app} virtual host file '${https_vhost}' is not writable. Configurations based on environment variables will not be applied for this file." + fi + fi +} diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh index a4111733e935..56bee8fcd235 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/postunpack.sh @@ -25,9 +25,10 @@ set -o pipefail [[ ! -f "$PHPMYADMIN_CONF_FILE" ]] && cp "${PHPMYADMIN_BASE_DIR}/config.sample.inc.php" "$PHPMYADMIN_CONF_FILE" # Ensure the phpMyAdmin 'tmp' directory exists and has proper permissions +ensure_user_exists "$WEB_SERVER_DAEMON_USER" "$WEB_SERVER_DAEMON_GROUP" for dir in "$PHPMYADMIN_BASE_DIR" "$PHPMYADMIN_TMP_DIR" "$PHPMYADMIN_VOLUME_DIR"; do ensure_dir_exists "$dir" - configure_permissions_ownership "$dir" -d "775" -f "664" + configure_permissions_ownership "$dir" -d "775" -f "664" -u "$WEB_SERVER_DAEMON_USER" -g "root" done # Configure phpMyAdmin based on build-time defaults diff --git a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/setup.sh b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/setup.sh index 3d0a9bb4292e..9a9cb0adc7b4 100755 --- a/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/setup.sh +++ b/bitnami/phpmyadmin/5/debian-10/rootfs/opt/bitnami/scripts/phpmyadmin/setup.sh @@ -20,13 +20,6 @@ set -o pipefail # Ensure phpMyAdmin environment variables are valid phpmyadmin_validate -# Ensure proper ownership for the phpMyAdmin 'tmp' directory -if am_i_root; then - ensure_user_exists "$WEB_SERVER_DAEMON_USER" "$WEB_SERVER_DAEMON_GROUP" - info "Ensuring phpMyAdmin directories have proper permissions" - configure_permissions_ownership "$PHPMYADMIN_TMP_DIR" -u "$WEB_SERVER_DAEMON_USER" -g "$WEB_SERVER_DAEMON_GROUP" -fi - # Ensure phpMyAdmin is initialized phpmyadmin_initialize diff --git a/bitnami/phpmyadmin/README.md b/bitnami/phpmyadmin/README.md index f05bc033fcdc..1a39dd724277 100644 --- a/bitnami/phpmyadmin/README.md +++ b/bitnami/phpmyadmin/README.md @@ -36,7 +36,7 @@ Bitnami containers can be used with [Kubeapps](https://kubeapps.com/) for deploy Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/). -* [`5-debian-10`, `5.0.2-debian-10-r106`, `5`, `5.0.2`, `latest` (5/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-phpmyadmin/blob/5.0.2-debian-10-r106/5/debian-10/Dockerfile) +* [`5-debian-10`, `5.0.2-debian-10-r107`, `5`, `5.0.2`, `latest` (5/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-phpmyadmin/blob/5.0.2-debian-10-r107/5/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/phpmyadmin GitHub repo](https://github.com/bitnami/bitnami-docker-phpmyadmin).