|
| 1 | +# from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements |
| 2 | +FROM php:7.4-apache-buster |
| 3 | + |
| 4 | +# install the PHP extensions we need |
| 5 | +RUN set -eux; \ |
| 6 | + \ |
| 7 | + if command -v a2enmod; then \ |
| 8 | + a2enmod rewrite; \ |
| 9 | + fi; \ |
| 10 | + \ |
| 11 | + savedAptMark="$(apt-mark showmanual)"; \ |
| 12 | + \ |
| 13 | + apt-get update; \ |
| 14 | + apt-get install -y --no-install-recommends \ |
| 15 | + libfreetype6-dev \ |
| 16 | + libjpeg-dev \ |
| 17 | + libpng-dev \ |
| 18 | + libpq-dev \ |
| 19 | + libzip-dev \ |
| 20 | + ; \ |
| 21 | + \ |
| 22 | + docker-php-ext-configure gd \ |
| 23 | + --with-freetype \ |
| 24 | + --with-jpeg=/usr \ |
| 25 | + ; \ |
| 26 | + \ |
| 27 | + docker-php-ext-install -j "$(nproc)" \ |
| 28 | + gd \ |
| 29 | + opcache \ |
| 30 | + pdo_mysql \ |
| 31 | + pdo_pgsql \ |
| 32 | + zip \ |
| 33 | + ; \ |
| 34 | + \ |
| 35 | +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies |
| 36 | + apt-mark auto '.*' > /dev/null; \ |
| 37 | + apt-mark manual $savedAptMark; \ |
| 38 | + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ |
| 39 | + | awk '/=>/ { print $3 }' \ |
| 40 | + | sort -u \ |
| 41 | + | xargs -r dpkg-query -S \ |
| 42 | + | cut -d: -f1 \ |
| 43 | + | sort -u \ |
| 44 | + | xargs -rt apt-mark manual; \ |
| 45 | + \ |
| 46 | + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ |
| 47 | + rm -rf /var/lib/apt/lists/* |
| 48 | + |
| 49 | +# set recommended PHP.ini settings |
| 50 | +# see https://secure.php.net/manual/en/opcache.installation.php |
| 51 | +RUN { \ |
| 52 | + echo 'opcache.memory_consumption=128'; \ |
| 53 | + echo 'opcache.interned_strings_buffer=8'; \ |
| 54 | + echo 'opcache.max_accelerated_files=4000'; \ |
| 55 | + echo 'opcache.revalidate_freq=60'; \ |
| 56 | + echo 'opcache.fast_shutdown=1'; \ |
| 57 | + } > /usr/local/etc/php/conf.d/opcache-recommended.ini |
| 58 | + |
| 59 | +WORKDIR /var/www/html |
| 60 | + |
| 61 | +# https://www.drupal.org/node/3060/release |
| 62 | +ENV DRUPAL_VERSION 9.0.1 |
| 63 | +ENV DRUPAL_MD5 18470946d20909e4762c143ff6684372 |
| 64 | + |
| 65 | +RUN set -eux; \ |
| 66 | + curl -fSL "https://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz" -o drupal.tar.gz; \ |
| 67 | + echo "${DRUPAL_MD5} *drupal.tar.gz" | md5sum -c -; \ |
| 68 | + tar -xz --strip-components=1 -f drupal.tar.gz; \ |
| 69 | + rm drupal.tar.gz; \ |
| 70 | + chown -R www-data:www-data sites modules themes |
| 71 | + |
| 72 | +# vim:set ft=dockerfile: |
0 commit comments