diff --git a/.all-contributorsrc b/.all-contributorsrc index 1972dd60..652dd0f1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -119,6 +119,15 @@ "contributions": [ "code" ] + }, + { + "login": "kiart-tantasi", + "name": "Kiart Tantasi", + "avatar_url": "https://avatars.githubusercontent.com/u/76615399?v=4", + "profile": "https://www.petchblog.net/", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 865077fb..0c828e46 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Official Mautic Docker Image -[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) > [!NOTE] @@ -213,6 +213,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d maxitromer
maxitromer

💻 ⚠️ Nick Vanpraet
Nick Vanpraet

👀 Marko Korhonen
Marko Korhonen

💻 + Kiart Tantasi
Kiart Tantasi

💻 diff --git a/apache/Dockerfile b/apache/Dockerfile index 9bd6229a..99a731d3 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3-apache AS builder +FROM php:8.3-apache-bookworm AS builder # Copy everything from common for building COPY ./common/ /common/ @@ -63,7 +63,7 @@ RUN cd /opt && \ rm -rf /opt/mautic/var/cache/js && \ find /opt/mautic/node_modules -mindepth 1 -maxdepth 1 -not \( -name 'jquery' -or -name 'vimeo-froogaloop2' \) | xargs rm -rf -FROM php:8.3-apache +FROM php:8.3-apache-bookworm LABEL vendor="Mautic" LABEL maintainer="Mautic core team <>" diff --git a/common/docker-entrypoint.sh b/common/docker-entrypoint.sh index a1d2f091..c5f778ee 100644 --- a/common/docker-entrypoint.sh +++ b/common/docker-entrypoint.sh @@ -12,6 +12,8 @@ export MAUTIC_DB_PORT="${MAUTIC_DB_PORT:-3306}" export MAUTIC_VOLUME_CONFIG="${MAUTIC_VOLUME_CONFIG:-/var/www/html/config}" export MAUTIC_VOLUME_LOGS="${MAUTIC_VOLUME_LOGS:-/var/www/html/var/logs}" export MAUTIC_VOLUME_MEDIA="${MAUTIC_VOLUME_MEDIA:-/var/www/html/docroot/media}" +export MAUTIC_VOLUME_FILES="${MAUTIC_VOLUME_FILES:-/var/www/html/docroot/media/files}" +export MAUTIC_VOLUME_IMAGES="${MAUTIC_VOLUME_IMAGES:-/var/www/html/docroot/media/images}" export MAUTIC_VAR="${MAUTIC_VAR:-/var/www/html/var}" export MAUTIC_CONSOLE="${MAUTIC_CONSOLE:-/var/www/html/bin/console}" @@ -25,7 +27,9 @@ export MAUTIC_VOLUMES="\ ${MAUTIC_VOLUME_CONFIG} \ ${MAUTIC_VAR} \ ${MAUTIC_VOLUME_LOGS} \ -${MAUTIC_VOLUME_MEDIA}" +${MAUTIC_VOLUME_MEDIA} \ +${MAUTIC_VOLUME_FILES} \ +${MAUTIC_VOLUME_IMAGES} " export REQUIRED_MAUTIC_VARIABLES="\ MAUTIC_DB_HOST \ diff --git a/common/entrypoint_mautic_web.sh b/common/entrypoint_mautic_web.sh index 8d0d5877..70da7208 100644 --- a/common/entrypoint_mautic_web.sh +++ b/common/entrypoint_mautic_web.sh @@ -1,5 +1,7 @@ #!/bin/bash +source /startup/logger.sh + # prepare mautic with test data if [ "$DOCKER_MAUTIC_LOAD_TEST_DATA" = "true" ]; then su -s /bin/bash $MAUTIC_WWW_USER -c "php $MAUTIC_CONSOLE doctrine:migrations:sync-metadata-storage" @@ -9,7 +11,12 @@ if [ "$DOCKER_MAUTIC_LOAD_TEST_DATA" = "true" ]; then fi # run migrations -su -s /bin/bash $MAUTIC_WWW_USER -c "php $MAUTIC_CONSOLE doctrine:migration:migrate -n" +if php -r "include('${MAUTIC_VOLUME_CONFIG}/local.php'); exit(!empty(\$parameters['db_driver']) && !empty(\$parameters['site_url']) ? 0 : 1);"; then + log "[${DOCKER_MAUTIC_ROLE}]: Mautic is already installed, running migrations..." + su -s /bin/bash $MAUTIC_WWW_USER -c "php $MAUTIC_CONSOLE doctrine:migrations:migrate -n" +else + log "[${DOCKER_MAUTIC_ROLE}]: Mautic is not installed, skipping migrations." +fi # execute the provided entrypoint "$@" diff --git a/common/startup/check_volumes_exist_ownership.sh b/common/startup/check_volumes_exist_ownership.sh index c522d38b..5e57e9f2 100644 --- a/common/startup/check_volumes_exist_ownership.sh +++ b/common/startup/check_volumes_exist_ownership.sh @@ -13,7 +13,7 @@ function check_volumes_exist_ownership { if [[ $ERROR_FOUND -eq 1 ]]; then log_startup_error_header - log_error "Please ensure the volume(s) are mounted correctly and is accessible." + log_error "Please ensure the volume(s) is mounted correctly and is accessible." log_error "If you are running this container as a non-root user, you may need to run the container with elevated privileges." exit 1 fi diff --git a/common/startup/wait_for_mautic_install.sh b/common/startup/wait_for_mautic_install.sh index 7b2a1725..cbbcb513 100644 --- a/common/startup/wait_for_mautic_install.sh +++ b/common/startup/wait_for_mautic_install.sh @@ -4,7 +4,7 @@ source /startup/logger.sh function wait_for_mautic_install { local COUNTER=0 - until php -r "include('${MAUTIC_VOLUME_CONFIG}/local.php'); exit(isset(\$parameters['site_url']) ? 0 : 1);"; do + until php -r "include('${MAUTIC_VOLUME_CONFIG}/local.php'); exit(!empty(\$parameters['db_driver']) && !empty(\$parameters['site_url']) ? 0 : 1);"; do log_debug "[${DOCKER_MAUTIC_ROLE}]: Waiting for Mautic to be installed, current attempt: ${COUNTER}." # only show message every 30 seconds (or DEBUG is enabled) if (( COUNTER % 6 == 0 )); then diff --git a/examples/basic/docker-compose.yml b/examples/basic/docker-compose.yml index 06b03a54..6c4d8d89 100644 --- a/examples/basic/docker-compose.yml +++ b/examples/basic/docker-compose.yml @@ -30,7 +30,7 @@ services: links: - db:mysql ports: - - 1111:80 + - 8080:80 volumes: *mautic-volumes environment: diff --git a/fpm/Dockerfile b/fpm/Dockerfile index d7093a41..cf807cce 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3-fpm AS builder +FROM php:8.3-fpm-bookworm AS builder # Copy everything from common for building COPY ./common/ /common/ @@ -63,7 +63,7 @@ RUN cd /opt && \ rm -rf /opt/mautic/var/cache/js && \ find /opt/mautic/node_modules -mindepth 1 -maxdepth 1 -not \( -name 'jquery' -or -name 'vimeo-froogaloop2' \) | xargs rm -rf -FROM php:8.3-fpm +FROM php:8.3-fpm-bookworm LABEL vendor="Mautic" LABEL maintainer="Mautic core team <>"