|
| 1 | +# |
| 2 | +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" |
| 3 | +# |
| 4 | +# PLEASE DO NOT EDIT IT DIRECTLY. |
| 5 | +# |
| 6 | + |
| 7 | +# from https://downloads.joomla.org/technical-requirements |
| 8 | +FROM php:8.3-apache |
| 9 | +LABEL maintainer="Llewellyn van der Merwe <llewellyn.van-der-merwe@community.joomla.org> (@Llewellynvdm), Harald Leithner <harald.leithner@community.joomla.org> (@HLeithner)" |
| 10 | + |
| 11 | +# Disable remote database security requirements. |
| 12 | +ENV JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK=1 |
| 13 | +RUN set -eux; \ |
| 14 | + apt-get update; \ |
| 15 | + apt-get install -y --no-install-recommends \ |
| 16 | +# Ghostscript is required for rendering PDF previews |
| 17 | + ghostscript \ |
| 18 | +# Needed for the zst joomla package |
| 19 | + zstd \ |
| 20 | + ; \ |
| 21 | + rm -rf /var/lib/apt/lists/* |
| 22 | + |
| 23 | +# install the PHP extensions we need. |
| 24 | +RUN set -ex; \ |
| 25 | + \ |
| 26 | + savedAptMark="$(apt-mark showmanual)"; \ |
| 27 | + \ |
| 28 | + apt-get update; \ |
| 29 | + apt-get install -y --no-install-recommends \ |
| 30 | + libbz2-dev \ |
| 31 | + libgmp-dev \ |
| 32 | + libicu-dev \ |
| 33 | + libfreetype6-dev \ |
| 34 | + libjpeg-dev \ |
| 35 | + libldap2-dev \ |
| 36 | + libmemcached-dev \ |
| 37 | + libmagickwand-dev \ |
| 38 | + libpq-dev \ |
| 39 | + libpng-dev \ |
| 40 | + libwebp-dev \ |
| 41 | + libzip-dev \ |
| 42 | + ; \ |
| 43 | + \ |
| 44 | + docker-php-ext-configure gd \ |
| 45 | + --with-freetype \ |
| 46 | + --with-jpeg \ |
| 47 | + --with-webp \ |
| 48 | + ; \ |
| 49 | + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ |
| 50 | + docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \ |
| 51 | + docker-php-ext-install -j "$(nproc)" \ |
| 52 | + bz2 \ |
| 53 | + bcmath \ |
| 54 | + exif \ |
| 55 | + gd \ |
| 56 | + gmp \ |
| 57 | + intl \ |
| 58 | + ldap \ |
| 59 | + mysqli \ |
| 60 | + pdo_mysql \ |
| 61 | + pdo_pgsql \ |
| 62 | + pgsql \ |
| 63 | + zip \ |
| 64 | + ; \ |
| 65 | +# https://pecl.php.net/package/imagick |
| 66 | +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) |
| 67 | +# see also https://github.com/Imagick/imagick/pull/641 |
| 68 | +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit |
| 69 | +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 |
| 70 | + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ |
| 71 | + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ |
| 72 | + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ |
| 73 | + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ |
| 74 | + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ |
| 75 | + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ |
| 76 | + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ |
| 77 | + docker-php-ext-install /tmp/imagick-3.7.0; \ |
| 78 | + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ |
| 79 | +# TODO when imagick has another release, we should ditch this whole block and just update instead |
| 80 | + \ |
| 81 | +# some misbehaving extensions end up outputting to stdout |
| 82 | + out="$(php -r 'exit(0);')"; \ |
| 83 | + [ -z "$out" ]; \ |
| 84 | + err="$(php -r 'exit(0);' 3>&1 1>&2 2>&3)"; \ |
| 85 | + [ -z "$err" ]; \ |
| 86 | + \ |
| 87 | + extDir="$(php -r 'echo ini_get("extension_dir");')"; \ |
| 88 | + [ -d "$extDir" ]; \ |
| 89 | +# pecl will claim success even if one install fails, so we need to perform each install separately |
| 90 | + pecl install APCu-5.1.24; \ |
| 91 | + pecl install memcached-3.3.0; \ |
| 92 | + pecl install redis-6.1.0; \ |
| 93 | + \ |
| 94 | + docker-php-ext-enable \ |
| 95 | + apcu \ |
| 96 | + memcached \ |
| 97 | + redis \ |
| 98 | + ; \ |
| 99 | + rm -r /tmp/pear; \ |
| 100 | + \ |
| 101 | +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies |
| 102 | + apt-mark auto '.*' > /dev/null; \ |
| 103 | + apt-mark manual $savedAptMark; \ |
| 104 | + ldd "$extDir"/*.so \ |
| 105 | + | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \ |
| 106 | + | sort -u \ |
| 107 | + | xargs -r dpkg-query --search \ |
| 108 | + | cut -d: -f1 \ |
| 109 | + | sort -u \ |
| 110 | + | xargs -rt apt-mark manual; \ |
| 111 | + \ |
| 112 | + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ |
| 113 | + rm -rf /var/lib/apt/lists/*; \ |
| 114 | + \ |
| 115 | + ! { ldd "$extDir"/*.so | grep 'not found'; }; \ |
| 116 | +# check for output like "PHP Warning: PHP Startup: Unable to load dynamic library 'foo' (tried: ...) |
| 117 | + err="$(php --version 3>&1 1>&2 2>&3)"; \ |
| 118 | + [ -z "$err" ] |
| 119 | + |
| 120 | +# set recommended PHP.ini settings |
| 121 | +# see https://secure.php.net/manual/en/opcache.installation.php |
| 122 | +RUN set -eux; \ |
| 123 | + docker-php-ext-enable opcache; \ |
| 124 | + { \ |
| 125 | + echo 'opcache.memory_consumption=128'; \ |
| 126 | + echo 'opcache.interned_strings_buffer=8'; \ |
| 127 | + echo 'opcache.max_accelerated_files=4000'; \ |
| 128 | + echo 'opcache.revalidate_freq=2'; \ |
| 129 | + } > /usr/local/etc/php/conf.d/opcache-recommended.ini |
| 130 | +# set recommended error logging |
| 131 | +RUN { \ |
| 132 | +# https://www.php.net/manual/en/errorfunc.constants.php |
| 133 | + echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \ |
| 134 | + echo 'display_errors = Off'; \ |
| 135 | + echo 'display_startup_errors = Off'; \ |
| 136 | + echo 'log_errors = On'; \ |
| 137 | + echo 'error_log = /dev/stderr'; \ |
| 138 | + echo 'log_errors_max_len = 1024'; \ |
| 139 | + echo 'ignore_repeated_errors = On'; \ |
| 140 | + echo 'ignore_repeated_source = Off'; \ |
| 141 | + echo 'html_errors = Off'; \ |
| 142 | + } > /usr/local/etc/php/conf.d/error-logging.ini |
| 143 | + |
| 144 | +RUN set -eux; \ |
| 145 | + a2enmod rewrite expires; \ |
| 146 | + \ |
| 147 | +# https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html |
| 148 | + a2enmod remoteip; \ |
| 149 | + { \ |
| 150 | + echo 'RemoteIPHeader X-Forwarded-For'; \ |
| 151 | +# these IP ranges are reserved for "private" use and should thus *usually* be safe inside Docker |
| 152 | + echo 'RemoteIPInternalProxy 10.0.0.0/8'; \ |
| 153 | + echo 'RemoteIPInternalProxy 172.16.0.0/12'; \ |
| 154 | + echo 'RemoteIPInternalProxy 192.168.0.0/16'; \ |
| 155 | + echo 'RemoteIPInternalProxy 169.254.0.0/16'; \ |
| 156 | + echo 'RemoteIPInternalProxy 127.0.0.0/8'; \ |
| 157 | + } > /etc/apache2/conf-available/remoteip.conf; \ |
| 158 | + a2enconf remoteip; \ |
| 159 | +# (replace all instances of "%h" with "%a" in LogFormat) |
| 160 | + find /etc/apache2 -type f -name '*.conf' -exec sed -ri 's/([[:space:]]*LogFormat[[:space:]]+"[^"]*)%h([^"]*")/\1%a\2/g' '{}' + |
| 161 | + |
| 162 | +VOLUME /var/www/html |
| 163 | + |
| 164 | +# Define Joomla version and expected SHA512 signature |
| 165 | +ENV JOOMLA_VERSION 6.0.0-alpha1 |
| 166 | +ENV JOOMLA_SHA512 9853eac2e4863ddeb183ab9edc7cf979b2823a76abbb8b9deaf613b56025858941df2ecee478964e56955d95440798b7e341487689b92493eb6a42089c43d054 |
| 167 | + |
| 168 | +# Download package and extract to web volume |
| 169 | +RUN set -ex; \ |
| 170 | + curl -o joomla.tar.zst -SL https://github.com/joomla/joomla-cms/releases/download/6.0.0-alpha1/Joomla_6.0.0-alpha1-Alpha-Full_Package.tar.zst; \ |
| 171 | + echo "$JOOMLA_SHA512 *joomla.tar.zst" | sha512sum -c -; \ |
| 172 | + mkdir /usr/src/joomla; \ |
| 173 | + tar --zstd -xf joomla.tar.zst -C /usr/src/joomla; \ |
| 174 | + rm joomla.tar.zst; \ |
| 175 | + chown -R www-data:www-data /usr/src/joomla |
| 176 | + |
| 177 | +# Copy init scripts |
| 178 | +COPY docker-entrypoint.sh /entrypoint.sh |
| 179 | +COPY makedb.php /makedb.php |
| 180 | + |
| 181 | +ENTRYPOINT ["/entrypoint.sh"] |
| 182 | +CMD ["apache2-foreground"] |
| 183 | + |
| 184 | + |
0 commit comments