diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 387a071..ea8090f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,9 +8,6 @@ on: - "images/**/*" # add workflow dispatch to manually publish the current images workflow_dispatch: - pull_request: - paths: - - "images/**/*" concurrency: # Cancel in-progress jobs if a new job is trigged by a commit from the same branch @@ -67,8 +64,8 @@ jobs: run: | taglist=$(yq 'map( ( - "friendsofredaxo/redaxo", - "ghcr.io/friendsofredaxo/redaxo" + "${{ env.REGISTRY_IMAGE }}", + "ghcr.io/${{ env.REGISTRY_IMAGE }}" ) + ":" + .[]) | to_csv' ./images/${{ matrix.image }}/tags.yml) echo "$taglist" diff --git a/README.md b/README.md index 7c719ee..382f49a 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ We provide two image variants: - **Stable:** `5-stable`, `5` Contains the latest stable REDAXO 5.x version and the lowest PHP version with [active support](https://www.php.net/supported-versions.php). - **Edge:** `5-edge` - Contains the latest REDAXO 5.x, even beta versions, and the latest PHP, even RC versions. - Use this image for development and testing. + Contains the latest REDAXO 5.x, even beta versions, and the latest PHP, even RC versions. + Use this image for development and testing. If you’re not sure, you probably want to go for `friendsofredaxo/redaxo:5` πŸš€ diff --git a/images/5-edge/Dockerfile b/images/5-edge/Dockerfile index 43b39d6..91b5b4e 100644 --- a/images/5-edge/Dockerfile +++ b/images/5-edge/Dockerfile @@ -2,86 +2,86 @@ FROM php:8.3-apache # install persistent PHP extensions (they won’t get purged afterwards) RUN set -eux; \ - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - ghostscript \ - locales \ - unzip \ - ; \ - rm -rf /var/lib/apt/lists/* + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + ghostscript \ + locales \ + unzip \ + ; \ + rm -rf /var/lib/apt/lists/* # generate locales RUN set -eux; \ - echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen + echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ + locale-gen # install PHP extensions RUN set -ex; \ - \ - # mark packages as being manually installed - # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html - savedAptMark="$(apt-mark showmanual)"; \ - \ - # install via apt-get - # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - libfreetype6-dev \ - libjpeg-dev \ - libmagickwand-dev \ - libmcrypt-dev \ - libpng-dev \ - libwebp-dev \ - libavif-dev \ - libzip-dev \ - ; \ - # install developer extensions - apt-get install -y --quiet --no-install-recommends \ - git \ - msmtp \ - msmtp-mta \ - ; \ - # install and configure via docker-php-ext - # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - --with-avif \ - ; \ - docker-php-ext-install -j "$(nproc)" \ - exif \ - gd \ - intl \ - pdo_mysql \ - zip \ - ; \ - # install imagick - # https://pecl.php.net/package/imagick - # pecl install imagick-3.7.0; \ - # docker-php-ext-enable imagick; \ - # rm -r /tmp/pear; \ - # \ - # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + # mark packages as being manually installed + # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html + savedAptMark="$(apt-mark showmanual)"; \ + \ + # install via apt-get + # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + libfreetype6-dev \ + libjpeg-dev \ + libmagickwand-dev \ + libmcrypt-dev \ + libpng-dev \ + libwebp-dev \ + libavif-dev \ + libzip-dev \ + ; \ + # install developer extensions + apt-get install -y --quiet --no-install-recommends \ + git \ + msmtp \ + msmtp-mta \ + ; \ + # install and configure via docker-php-ext + # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions + docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + --with-avif \ + ; \ + docker-php-ext-install -j "$(nproc)" \ + exif \ + gd \ + intl \ + pdo_mysql \ + zip \ + ; \ + # install imagick + # https://pecl.php.net/package/imagick + # pecl install imagick-3.7.0; \ + # docker-php-ext-enable imagick; \ + # rm -r /tmp/pear; \ + # \ + # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* # install composer COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer @@ -89,28 +89,28 @@ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer # enable OPcache # see https://secure.php.net/manual/en/opcache.installation.php RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini + docker-php-ext-enable opcache; \ + { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini # enable apache modules RUN set -eux; \ - a2enmod expires headers rewrite ssl + a2enmod expires headers rewrite ssl # create mount point for web root VOLUME /var/www/html # fetch REDAXO, validate checksum and extract to tmp folder RUN set -e; \ - curl -Ls -o redaxo.zip https://github.com/redaxo/redaxo/releases/download/5.15.1/redaxo_5.15.1.zip; \ - echo "7936b2055b670377be97f8c8a4e90ce46f0a6ad7 *redaxo.zip" | shasum -c -a 256; \ - unzip -oq redaxo.zip -d /usr/src/redaxo; \ - rm redaxo.zip; \ - chown -R www-data:www-data /usr/src/redaxo + curl -Ls -o redaxo.zip https://github.com/redaxo/redaxo/releases/download/5.15.1/redaxo_5.15.1.zip; \ + echo "7936b2055b670377be97f8c8a4e90ce46f0a6ad7 *redaxo.zip" | shasum -c -a 256; \ + unzip -oq redaxo.zip -d /usr/src/redaxo; \ + rm redaxo.zip; \ + chown -R www-data:www-data /usr/src/redaxo # copy and run entrypoint COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/images/5-edge/docker-entrypoint.sh b/images/5-edge/docker-entrypoint.sh index 4cb0436..d743d20 100755 --- a/images/5-edge/docker-entrypoint.sh +++ b/images/5-edge/docker-entrypoint.sh @@ -2,98 +2,98 @@ set -euo pipefail if [[ -n "$(ls -A)" ]]; then - echo >&2 " " - echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." - echo >&2 " " + echo >&2 " " + echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." + echo >&2 " " else - echo >&2 "πŸ‘‰ Start REDAXO setup..." + echo >&2 "πŸ‘‰ Start REDAXO setup..." - # copy REDAXO to web root - cp -Rp /usr/src/redaxo/. ./ && \ - echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." + # copy REDAXO to web root + cp -Rp /usr/src/redaxo/. ./ && \ + echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." - # copy default config - mkdir -p redaxo/data/core/ && \ - cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ - echo >&2 "βœ… Default configuration has been successfully copied." + # copy default config + mkdir -p redaxo/data/core/ && \ + cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ + echo >&2 "βœ… Default configuration has been successfully copied." - # install REDAXO via cli command if available (REDAXO 5.9+) - if php redaxo/bin/console setup:run; then + # install REDAXO via cli command if available (REDAXO 5.9+) + if php redaxo/bin/console setup:run; then - # prepare database - # remember the docker database container takes some time to init! - echo >&2 "πŸ‘‰ Prepare database..." - repeat=10 - while ! php redaxo/bin/console -q db:set-connection \ - --host=$REDAXO_DB_HOST \ - --database=$REDAXO_DB_NAME \ - --login=$REDAXO_DB_LOGIN \ - --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do - if [[ repeat -eq 0 ]]; then - echo >&2 "❌ Failed to connect database." - exit 1 - fi - repeat=$((repeat - 1)) - sleep 5 - echo >&2 "⏳ Wait for database connection... ($repeat)" - done - echo >&2 "βœ… Database has been has been successfully connected." + # prepare database + # remember the docker database container takes some time to init! + echo >&2 "πŸ‘‰ Prepare database..." + repeat=10 + while ! php redaxo/bin/console -q db:set-connection \ + --host=$REDAXO_DB_HOST \ + --database=$REDAXO_DB_NAME \ + --login=$REDAXO_DB_LOGIN \ + --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do + if [[ repeat -eq 0 ]]; then + echo >&2 "❌ Failed to connect database." + exit 1 + fi + repeat=$((repeat - 1)) + sleep 5 + echo >&2 "⏳ Wait for database connection... ($repeat)" + done + echo >&2 "βœ… Database has been has been successfully connected." - # run REDAXO setup - # hint: get options via `php redaxo/bin/console setup:run --help` - echo >&2 "πŸ‘‰ Run setup..." - setupArgs=( - "--agree-license" - "--db-createdb=no" - "--db-setup=normal" - ); - [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); - [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); - [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); - [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); - [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); - [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); - [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! - [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); - [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); + # run REDAXO setup + # hint: get options via `php redaxo/bin/console setup:run --help` + echo >&2 "πŸ‘‰ Run setup..." + setupArgs=( + "--agree-license" + "--db-createdb=no" + "--db-setup=normal" + ); + [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); + [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); + [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); + [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); + [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); + [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); + [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! + [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); + [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); - if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then - echo >&2 "βœ… REDAXO has been successfully installed." - else - echo >&2 " " - echo >&2 "❌ REDAXO setup failed." - echo >&2 " " - exit 1 - fi - fi + if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then + echo >&2 "βœ… REDAXO has been successfully installed." + else + echo >&2 " " + echo >&2 "❌ REDAXO setup failed." + echo >&2 " " + exit 1 + fi + fi - # update file owner and group of writable folders (cache, data) - chown -R www-data:www-data redaxo/cache redaxo/data; + # update file owner and group of writable folders (cache, data) + chown -R www-data:www-data redaxo/cache redaxo/data; - # done! - echo >&2 " " - echo >&2 "πŸš€ REDAXO setup successful." - echo >&2 " " + # done! + echo >&2 " " + echo >&2 "πŸš€ REDAXO setup successful." + echo >&2 " " - # run custom setup (if available) - # hint: enables child images to extend the setup process - CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; - if [[ -x "$CUSTOM_SETUP" ]]; then - echo >&2 "πŸ‘‰ Run custom setup..." + # run custom setup (if available) + # hint: enables child images to extend the setup process + CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; + if [[ -x "$CUSTOM_SETUP" ]]; then + echo >&2 "πŸ‘‰ Run custom setup..." - if "$CUSTOM_SETUP"; then - echo >&2 " " - echo >&2 "πŸš€ Custom setup successful." - echo >&2 " " - else - echo >&2 " " - echo >&2 "❌ Custom setup failed." - echo >&2 " " - exit 1 - fi - fi + if "$CUSTOM_SETUP"; then + echo >&2 " " + echo >&2 "πŸš€ Custom setup successful." + echo >&2 " " + else + echo >&2 " " + echo >&2 "❌ Custom setup failed." + echo >&2 " " + exit 1 + fi + fi fi # execute CMD diff --git a/images/5-stable/Dockerfile b/images/5-stable/Dockerfile index a9b8e8e..5fec7ee 100644 --- a/images/5-stable/Dockerfile +++ b/images/5-stable/Dockerfile @@ -2,86 +2,86 @@ FROM php:8.2-apache # install persistent PHP extensions (they won’t get purged afterwards) RUN set -eux; \ - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - ghostscript \ - locales \ - unzip \ - ; \ - rm -rf /var/lib/apt/lists/* + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + ghostscript \ + locales \ + unzip \ + ; \ + rm -rf /var/lib/apt/lists/* # generate locales RUN set -eux; \ - echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen + echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ + locale-gen # install PHP extensions RUN set -ex; \ - \ - # mark packages as being manually installed - # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html - savedAptMark="$(apt-mark showmanual)"; \ - \ - # install via apt-get - # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - libfreetype6-dev \ - libjpeg-dev \ - libmagickwand-dev \ - libmcrypt-dev \ - libpng-dev \ - libwebp-dev \ - libavif-dev \ - libzip-dev \ - ; \ - # install developer extensions - apt-get install -y --quiet --no-install-recommends \ - git \ - msmtp \ - msmtp-mta \ - ; \ - # install and configure via docker-php-ext - # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - --with-avif \ - ; \ - docker-php-ext-install -j "$(nproc)" \ - exif \ - gd \ - intl \ - pdo_mysql \ - zip \ - ; \ - # install imagick - # https://pecl.php.net/package/imagick - # pecl install imagick-3.7.0; \ - # docker-php-ext-enable imagick; \ - # rm -r /tmp/pear; \ - # \ - # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + # mark packages as being manually installed + # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html + savedAptMark="$(apt-mark showmanual)"; \ + \ + # install via apt-get + # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + libfreetype6-dev \ + libjpeg-dev \ + libmagickwand-dev \ + libmcrypt-dev \ + libpng-dev \ + libwebp-dev \ + libavif-dev \ + libzip-dev \ + ; \ + # install developer extensions + apt-get install -y --quiet --no-install-recommends \ + git \ + msmtp \ + msmtp-mta \ + ; \ + # install and configure via docker-php-ext + # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions + docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + --with-avif \ + ; \ + docker-php-ext-install -j "$(nproc)" \ + exif \ + gd \ + intl \ + pdo_mysql \ + zip \ + ; \ + # install imagick + # https://pecl.php.net/package/imagick + # pecl install imagick-3.7.0; \ + # docker-php-ext-enable imagick; \ + # rm -r /tmp/pear; \ + # \ + # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* # install composer COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer @@ -89,28 +89,28 @@ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer # enable OPcache # see https://secure.php.net/manual/en/opcache.installation.php RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini + docker-php-ext-enable opcache; \ + { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini # enable apache modules RUN set -eux; \ - a2enmod expires headers rewrite ssl + a2enmod expires headers rewrite ssl # create mount point for web root VOLUME /var/www/html # fetch REDAXO, validate checksum and extract to tmp folder RUN set -e; \ - curl -Ls -o redaxo.zip https://github.com/redaxo/redaxo/releases/download/5.15.1/redaxo_5.15.1.zip; \ - echo "7936b2055b670377be97f8c8a4e90ce46f0a6ad7 *redaxo.zip" | shasum -c -a 256; \ - unzip -oq redaxo.zip -d /usr/src/redaxo; \ - rm redaxo.zip; \ - chown -R www-data:www-data /usr/src/redaxo + curl -Ls -o redaxo.zip https://github.com/redaxo/redaxo/releases/download/5.15.1/redaxo_5.15.1.zip; \ + echo "7936b2055b670377be97f8c8a4e90ce46f0a6ad7 *redaxo.zip" | shasum -c -a 256; \ + unzip -oq redaxo.zip -d /usr/src/redaxo; \ + rm redaxo.zip; \ + chown -R www-data:www-data /usr/src/redaxo # copy and run entrypoint COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/images/5-stable/docker-entrypoint.sh b/images/5-stable/docker-entrypoint.sh index 4cb0436..d743d20 100755 --- a/images/5-stable/docker-entrypoint.sh +++ b/images/5-stable/docker-entrypoint.sh @@ -2,98 +2,98 @@ set -euo pipefail if [[ -n "$(ls -A)" ]]; then - echo >&2 " " - echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." - echo >&2 " " + echo >&2 " " + echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." + echo >&2 " " else - echo >&2 "πŸ‘‰ Start REDAXO setup..." + echo >&2 "πŸ‘‰ Start REDAXO setup..." - # copy REDAXO to web root - cp -Rp /usr/src/redaxo/. ./ && \ - echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." + # copy REDAXO to web root + cp -Rp /usr/src/redaxo/. ./ && \ + echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." - # copy default config - mkdir -p redaxo/data/core/ && \ - cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ - echo >&2 "βœ… Default configuration has been successfully copied." + # copy default config + mkdir -p redaxo/data/core/ && \ + cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ + echo >&2 "βœ… Default configuration has been successfully copied." - # install REDAXO via cli command if available (REDAXO 5.9+) - if php redaxo/bin/console setup:run; then + # install REDAXO via cli command if available (REDAXO 5.9+) + if php redaxo/bin/console setup:run; then - # prepare database - # remember the docker database container takes some time to init! - echo >&2 "πŸ‘‰ Prepare database..." - repeat=10 - while ! php redaxo/bin/console -q db:set-connection \ - --host=$REDAXO_DB_HOST \ - --database=$REDAXO_DB_NAME \ - --login=$REDAXO_DB_LOGIN \ - --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do - if [[ repeat -eq 0 ]]; then - echo >&2 "❌ Failed to connect database." - exit 1 - fi - repeat=$((repeat - 1)) - sleep 5 - echo >&2 "⏳ Wait for database connection... ($repeat)" - done - echo >&2 "βœ… Database has been has been successfully connected." + # prepare database + # remember the docker database container takes some time to init! + echo >&2 "πŸ‘‰ Prepare database..." + repeat=10 + while ! php redaxo/bin/console -q db:set-connection \ + --host=$REDAXO_DB_HOST \ + --database=$REDAXO_DB_NAME \ + --login=$REDAXO_DB_LOGIN \ + --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do + if [[ repeat -eq 0 ]]; then + echo >&2 "❌ Failed to connect database." + exit 1 + fi + repeat=$((repeat - 1)) + sleep 5 + echo >&2 "⏳ Wait for database connection... ($repeat)" + done + echo >&2 "βœ… Database has been has been successfully connected." - # run REDAXO setup - # hint: get options via `php redaxo/bin/console setup:run --help` - echo >&2 "πŸ‘‰ Run setup..." - setupArgs=( - "--agree-license" - "--db-createdb=no" - "--db-setup=normal" - ); - [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); - [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); - [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); - [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); - [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); - [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); - [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! - [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); - [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); + # run REDAXO setup + # hint: get options via `php redaxo/bin/console setup:run --help` + echo >&2 "πŸ‘‰ Run setup..." + setupArgs=( + "--agree-license" + "--db-createdb=no" + "--db-setup=normal" + ); + [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); + [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); + [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); + [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); + [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); + [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); + [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! + [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); + [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); - if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then - echo >&2 "βœ… REDAXO has been successfully installed." - else - echo >&2 " " - echo >&2 "❌ REDAXO setup failed." - echo >&2 " " - exit 1 - fi - fi + if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then + echo >&2 "βœ… REDAXO has been successfully installed." + else + echo >&2 " " + echo >&2 "❌ REDAXO setup failed." + echo >&2 " " + exit 1 + fi + fi - # update file owner and group of writable folders (cache, data) - chown -R www-data:www-data redaxo/cache redaxo/data; + # update file owner and group of writable folders (cache, data) + chown -R www-data:www-data redaxo/cache redaxo/data; - # done! - echo >&2 " " - echo >&2 "πŸš€ REDAXO setup successful." - echo >&2 " " + # done! + echo >&2 " " + echo >&2 "πŸš€ REDAXO setup successful." + echo >&2 " " - # run custom setup (if available) - # hint: enables child images to extend the setup process - CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; - if [[ -x "$CUSTOM_SETUP" ]]; then - echo >&2 "πŸ‘‰ Run custom setup..." + # run custom setup (if available) + # hint: enables child images to extend the setup process + CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; + if [[ -x "$CUSTOM_SETUP" ]]; then + echo >&2 "πŸ‘‰ Run custom setup..." - if "$CUSTOM_SETUP"; then - echo >&2 " " - echo >&2 "πŸš€ Custom setup successful." - echo >&2 " " - else - echo >&2 " " - echo >&2 "❌ Custom setup failed." - echo >&2 " " - exit 1 - fi - fi + if "$CUSTOM_SETUP"; then + echo >&2 " " + echo >&2 "πŸš€ Custom setup successful." + echo >&2 " " + else + echo >&2 " " + echo >&2 "❌ Custom setup failed." + echo >&2 " " + exit 1 + fi + fi fi # execute CMD diff --git a/scripts/generate-image-files.ts b/scripts/generate-image-files.ts index ad3f37e..26ccaf2 100644 --- a/scripts/generate-image-files.ts +++ b/scripts/generate-image-files.ts @@ -11,15 +11,15 @@ const imagesDirectory = 'images'; const imageConfiguration = parse(Deno.readTextFileSync(`${sourceDirectory}/images.yml`)); if (!isObject(imageConfiguration)) { - console.error("Invalid image configuration!"); - Deno.exit(1); + console.error("Invalid image configuration!"); + Deno.exit(1); } const images = imageConfiguration["images"]; if (!isArray(images)) { - console.error("Invalid images array!"); - Deno.exit(1); + console.error("Invalid images array!"); + Deno.exit(1); } /** @@ -35,37 +35,37 @@ const dockerfileSource = Deno.readTextFileSync(`${sourceDirectory}/Dockerfile`); for (const image of images) { - const targetDir = `${imagesDirectory}/${image["name"]}`; - ensureDirSync(targetDir); + const targetDir = `${imagesDirectory}/${image["name"]}`; + ensureDirSync(targetDir); - /** - * Generate Dockerfile - */ - const replacements: Record = { - '%%PHP_VERSION_TAG%%': `${image["php-version"]}`, - '%%PACKAGE_URL%%': `${image["package-url"]}`, - '%%PACKAGE_SHA%%': `${image["package-sha"]}`, - }; - let currentDockerfileSource = dockerfileSource; - Object.keys(replacements).forEach((key) => { - currentDockerfileSource = currentDockerfileSource.replaceAll(key, replacements[key]); - }); + /** + * Generate Dockerfile + */ + const replacements: Record = { + '%%PHP_VERSION_TAG%%': `${image["php-version"]}`, + '%%PACKAGE_URL%%': `${image["package-url"]}`, + '%%PACKAGE_SHA%%': `${image["package-sha"]}`, + }; + let currentDockerfileSource = dockerfileSource; + Object.keys(replacements).forEach((key) => { + currentDockerfileSource = currentDockerfileSource.replaceAll(key, replacements[key]); + }); - Deno.writeTextFileSync(`${targetDir}/Dockerfile`, currentDockerfileSource); + Deno.writeTextFileSync(`${targetDir}/Dockerfile`, currentDockerfileSource); - /** - * Copy static files that do not require replacements - */ - const filesToCopy = [ - `docker-entrypoint.sh`, - ]; - filesToCopy.forEach(file => { - copySync(`${sourceDirectory}/${file}`, `${targetDir}/${file}`); - }) + /** + * Copy static files that do not require replacements + */ + const filesToCopy = [ + `docker-entrypoint.sh`, + ]; + filesToCopy.forEach(file => { + copySync(`${sourceDirectory}/${file}`, `${targetDir}/${file}`); + }) - /** - * Generate tag list - */ - const tagList = stringify({ tags: image["tags"] }); - Deno.writeTextFileSync(`${targetDir}/tags.yml`, tagList); + /** + * Generate tag list + */ + const tagList = stringify({ tags: image["tags"] }); + Deno.writeTextFileSync(`${targetDir}/tags.yml`, tagList); } diff --git a/source/Dockerfile b/source/Dockerfile index fc83cf3..518b9f3 100644 --- a/source/Dockerfile +++ b/source/Dockerfile @@ -2,86 +2,86 @@ FROM php:%%PHP_VERSION_TAG%%-apache # install persistent PHP extensions (they won’t get purged afterwards) RUN set -eux; \ - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - ghostscript \ - locales \ - unzip \ - ; \ - rm -rf /var/lib/apt/lists/* + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + ghostscript \ + locales \ + unzip \ + ; \ + rm -rf /var/lib/apt/lists/* # generate locales RUN set -eux; \ - echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ - echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ - locale-gen + echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "es_ES.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "pt_BR.UTF-8 UTF-8" >> /etc/locale.gen; \ + echo "sv_SE.UTF-8 UTF-8" >> /etc/locale.gen; \ + locale-gen # install PHP extensions RUN set -ex; \ - \ - # mark packages as being manually installed - # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html - savedAptMark="$(apt-mark showmanual)"; \ - \ - # install via apt-get - # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html - apt-get update; \ - apt-get install -y --quiet --no-install-recommends \ - libfreetype6-dev \ - libjpeg-dev \ - libmagickwand-dev \ - libmcrypt-dev \ - libpng-dev \ - libwebp-dev \ - libavif-dev \ - libzip-dev \ - ; \ - # install developer extensions - apt-get install -y --quiet --no-install-recommends \ - git \ - msmtp \ - msmtp-mta \ - ; \ - # install and configure via docker-php-ext - # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions - docker-php-ext-configure gd \ - --with-freetype \ - --with-jpeg \ - --with-webp \ - --with-avif \ - ; \ - docker-php-ext-install -j "$(nproc)" \ - exif \ - gd \ - intl \ - pdo_mysql \ - zip \ - ; \ - # install imagick - # https://pecl.php.net/package/imagick - # pecl install imagick-3.7.0; \ - # docker-php-ext-enable imagick; \ - # rm -r /tmp/pear; \ - # \ - # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* + \ + # mark packages as being manually installed + # see https://manpages.debian.org/stretch/apt/apt-mark.8.en.html + savedAptMark="$(apt-mark showmanual)"; \ + \ + # install via apt-get + # see https://manpages.debian.org/stretch/apt/apt-get.8.en.html + apt-get update; \ + apt-get install -y --quiet --no-install-recommends \ + libfreetype6-dev \ + libjpeg-dev \ + libmagickwand-dev \ + libmcrypt-dev \ + libpng-dev \ + libwebp-dev \ + libavif-dev \ + libzip-dev \ + ; \ + # install developer extensions + apt-get install -y --quiet --no-install-recommends \ + git \ + msmtp \ + msmtp-mta \ + ; \ + # install and configure via docker-php-ext + # see https://github.com/docker-library/docs/tree/master/php#how-to-install-more-php-extensions + docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + --with-avif \ + ; \ + docker-php-ext-install -j "$(nproc)" \ + exif \ + gd \ + intl \ + pdo_mysql \ + zip \ + ; \ + # install imagick + # https://pecl.php.net/package/imagick + # pecl install imagick-3.7.0; \ + # docker-php-ext-enable imagick; \ + # rm -r /tmp/pear; \ + # \ + # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + # see https://github.com/docker-library/wordpress/blob/master/Dockerfile.template + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/* # install composer COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer @@ -89,28 +89,28 @@ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer # enable OPcache # see https://secure.php.net/manual/en/opcache.installation.php RUN set -eux; \ - docker-php-ext-enable opcache; \ - { \ - echo 'opcache.memory_consumption=128'; \ - echo 'opcache.interned_strings_buffer=8'; \ - echo 'opcache.max_accelerated_files=4000'; \ - echo 'opcache.revalidate_freq=2'; \ - } > /usr/local/etc/php/conf.d/opcache-recommended.ini + docker-php-ext-enable opcache; \ + { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=2'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini # enable apache modules RUN set -eux; \ - a2enmod expires headers rewrite ssl + a2enmod expires headers rewrite ssl # create mount point for web root VOLUME /var/www/html # fetch REDAXO, validate checksum and extract to tmp folder RUN set -e; \ - curl -Ls -o redaxo.zip %%PACKAGE_URL%%; \ - echo "%%PACKAGE_SHA%% *redaxo.zip" | shasum -c -a 256; \ - unzip -oq redaxo.zip -d /usr/src/redaxo; \ - rm redaxo.zip; \ - chown -R www-data:www-data /usr/src/redaxo + curl -Ls -o redaxo.zip %%PACKAGE_URL%%; \ + echo "%%PACKAGE_SHA%% *redaxo.zip" | shasum -c -a 256; \ + unzip -oq redaxo.zip -d /usr/src/redaxo; \ + rm redaxo.zip; \ + chown -R www-data:www-data /usr/src/redaxo # copy and run entrypoint COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/source/docker-entrypoint.sh b/source/docker-entrypoint.sh index 4cb0436..d743d20 100755 --- a/source/docker-entrypoint.sh +++ b/source/docker-entrypoint.sh @@ -2,98 +2,98 @@ set -euo pipefail if [[ -n "$(ls -A)" ]]; then - echo >&2 " " - echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." - echo >&2 " " + echo >&2 " " + echo >&2 "❌ ${PWD} is not empty! Skip REDAXO setup." + echo >&2 " " else - echo >&2 "πŸ‘‰ Start REDAXO setup..." + echo >&2 "πŸ‘‰ Start REDAXO setup..." - # copy REDAXO to web root - cp -Rp /usr/src/redaxo/. ./ && \ - echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." + # copy REDAXO to web root + cp -Rp /usr/src/redaxo/. ./ && \ + echo >&2 "βœ… REDAXO has been successfully copied to ${PWD}." - # copy default config - mkdir -p redaxo/data/core/ && \ - cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ - echo >&2 "βœ… Default configuration has been successfully copied." + # copy default config + mkdir -p redaxo/data/core/ && \ + cp -fp redaxo/src/core/default.config.yml redaxo/data/core/config.yml && \ + echo >&2 "βœ… Default configuration has been successfully copied." - # install REDAXO via cli command if available (REDAXO 5.9+) - if php redaxo/bin/console setup:run; then + # install REDAXO via cli command if available (REDAXO 5.9+) + if php redaxo/bin/console setup:run; then - # prepare database - # remember the docker database container takes some time to init! - echo >&2 "πŸ‘‰ Prepare database..." - repeat=10 - while ! php redaxo/bin/console -q db:set-connection \ - --host=$REDAXO_DB_HOST \ - --database=$REDAXO_DB_NAME \ - --login=$REDAXO_DB_LOGIN \ - --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do - if [[ repeat -eq 0 ]]; then - echo >&2 "❌ Failed to connect database." - exit 1 - fi - repeat=$((repeat - 1)) - sleep 5 - echo >&2 "⏳ Wait for database connection... ($repeat)" - done - echo >&2 "βœ… Database has been has been successfully connected." + # prepare database + # remember the docker database container takes some time to init! + echo >&2 "πŸ‘‰ Prepare database..." + repeat=10 + while ! php redaxo/bin/console -q db:set-connection \ + --host=$REDAXO_DB_HOST \ + --database=$REDAXO_DB_NAME \ + --login=$REDAXO_DB_LOGIN \ + --password=$REDAXO_DB_PASSWORD 2> /dev/null || false; do + if [[ repeat -eq 0 ]]; then + echo >&2 "❌ Failed to connect database." + exit 1 + fi + repeat=$((repeat - 1)) + sleep 5 + echo >&2 "⏳ Wait for database connection... ($repeat)" + done + echo >&2 "βœ… Database has been has been successfully connected." - # run REDAXO setup - # hint: get options via `php redaxo/bin/console setup:run --help` - echo >&2 "πŸ‘‰ Run setup..." - setupArgs=( - "--agree-license" - "--db-createdb=no" - "--db-setup=normal" - ); - [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); - [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); - [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); - [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); - [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); - [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); - [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! - [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); - [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); + # run REDAXO setup + # hint: get options via `php redaxo/bin/console setup:run --help` + echo >&2 "πŸ‘‰ Run setup..." + setupArgs=( + "--agree-license" + "--db-createdb=no" + "--db-setup=normal" + ); + [[ -n "$REDAXO_LANG" ]] && setupArgs+=("--lang=${REDAXO_LANG}"); + [[ -n "$REDAXO_SERVER" ]] && setupArgs+=("--server=${REDAXO_SERVER}"); + [[ -n "$REDAXO_SERVERNAME" ]] && setupArgs+=("--servername=${REDAXO_SERVERNAME}"); + [[ -n "$REDAXO_ERROR_EMAIL" ]] && setupArgs+=("--error-email=${REDAXO_ERROR_EMAIL}"); + [[ -n "$REDAXO_TIMEZONE" ]] && setupArgs+=("--timezone=${REDAXO_TIMEZONE}"); + [[ -n "$REDAXO_DB_CHARSET" ]] && setupArgs+=("--db-charset=${REDAXO_DB_CHARSET}"); + [[ -n "$REDAXO_DB_PASSWORD" ]] && setupArgs+=("--db-password=${REDAXO_DB_PASSWORD}"); # required again! + [[ -n "$REDAXO_ADMIN_USER" ]] && setupArgs+=("--admin-username=${REDAXO_ADMIN_USER}"); + [[ -n "$REDAXO_ADMIN_PASSWORD" ]] && setupArgs+=("--admin-password=${REDAXO_ADMIN_PASSWORD}"); - if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then - echo >&2 "βœ… REDAXO has been successfully installed." - else - echo >&2 " " - echo >&2 "❌ REDAXO setup failed." - echo >&2 " " - exit 1 - fi - fi + if php redaxo/bin/console setup:run -q -n "${setupArgs[@]}"; then + echo >&2 "βœ… REDAXO has been successfully installed." + else + echo >&2 " " + echo >&2 "❌ REDAXO setup failed." + echo >&2 " " + exit 1 + fi + fi - # update file owner and group of writable folders (cache, data) - chown -R www-data:www-data redaxo/cache redaxo/data; + # update file owner and group of writable folders (cache, data) + chown -R www-data:www-data redaxo/cache redaxo/data; - # done! - echo >&2 " " - echo >&2 "πŸš€ REDAXO setup successful." - echo >&2 " " + # done! + echo >&2 " " + echo >&2 "πŸš€ REDAXO setup successful." + echo >&2 " " - # run custom setup (if available) - # hint: enables child images to extend the setup process - CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; - if [[ -x "$CUSTOM_SETUP" ]]; then - echo >&2 "πŸ‘‰ Run custom setup..." + # run custom setup (if available) + # hint: enables child images to extend the setup process + CUSTOM_SETUP="/usr/local/bin/custom-setup.sh"; + if [[ -x "$CUSTOM_SETUP" ]]; then + echo >&2 "πŸ‘‰ Run custom setup..." - if "$CUSTOM_SETUP"; then - echo >&2 " " - echo >&2 "πŸš€ Custom setup successful." - echo >&2 " " - else - echo >&2 " " - echo >&2 "❌ Custom setup failed." - echo >&2 " " - exit 1 - fi - fi + if "$CUSTOM_SETUP"; then + echo >&2 " " + echo >&2 "πŸš€ Custom setup successful." + echo >&2 " " + else + echo >&2 " " + echo >&2 "❌ Custom setup failed." + echo >&2 " " + exit 1 + fi + fi fi # execute CMD