|
| 1 | +FROM php:7.3-apache |
| 2 | + |
| 3 | +ENV APACHE_DOCUMENT_ROOT=/var/www/html/web |
| 4 | +RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf |
| 5 | +RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf |
| 6 | + |
| 7 | +# install the PHP extensions we need |
| 8 | +RUN set -ex; \ |
| 9 | + \ |
| 10 | + savedAptMark="$(apt-mark showmanual)"; \ |
| 11 | + \ |
| 12 | + apt-get update; \ |
| 13 | + apt-get install -y --no-install-recommends \ |
| 14 | + libjpeg-dev \ |
| 15 | + libpng-dev \ |
| 16 | + libzip-dev \ |
| 17 | + ; \ |
| 18 | + \ |
| 19 | + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ |
| 20 | + docker-php-ext-install gd mysqli opcache zip; \ |
| 21 | + \ |
| 22 | +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies |
| 23 | + apt-mark auto '.*' > /dev/null; \ |
| 24 | + apt-mark manual $savedAptMark; \ |
| 25 | + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ |
| 26 | + | awk '/=>/ { print $3 }' \ |
| 27 | + | sort -u \ |
| 28 | + | xargs -r dpkg-query -S \ |
| 29 | + | cut -d: -f1 \ |
| 30 | + | sort -u \ |
| 31 | + | xargs -rt apt-mark manual; \ |
| 32 | + \ |
| 33 | + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ |
| 34 | + rm -rf /var/lib/apt/lists/* |
| 35 | + |
| 36 | +# set recommended PHP.ini settings |
| 37 | +# see https://secure.php.net/manual/en/opcache.installation.php |
| 38 | +RUN { \ |
| 39 | + echo 'opcache.memory_consumption=128'; \ |
| 40 | + echo 'opcache.interned_strings_buffer=8'; \ |
| 41 | + echo 'opcache.max_accelerated_files=4000'; \ |
| 42 | + echo 'opcache.revalidate_freq=2'; \ |
| 43 | + echo 'opcache.fast_shutdown=1'; \ |
| 44 | + echo 'opcache.enable_cli=1'; \ |
| 45 | + } > /usr/local/etc/php/conf.d/opcache-recommended.ini |
| 46 | + |
| 47 | +RUN a2enmod rewrite expires |
| 48 | + |
| 49 | +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer |
| 50 | + |
| 51 | +CMD ["apache2-foreground"] |
| 52 | + |
0 commit comments