|
| 1 | +ARG VERSION=7.4-fpm |
| 2 | +ARG FLAVOUR="" |
| 3 | + |
| 4 | +FROM node:lts${FLAVOUR} AS node_lts |
| 5 | +FROM nginx:stable${FLAVOUR} AS nginx_stable |
| 6 | +FROM thisisdevelopment/docker-user-init:latest${FLAVOUR} AS docker-user-init |
| 7 | +FROM scratch AS overlay |
| 8 | + |
| 9 | +COPY --from=docker-user-init /docker-user-init /usr/bin/ |
| 10 | +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ |
| 11 | +COPY --from=composer /usr/bin/composer /usr/bin/composer |
| 12 | +COPY --from=node_lts /usr/local /usr/local |
| 13 | +COPY --from=node_lts /opt/yarn* /opt/ |
| 14 | +COPY --from=nginx_stable /usr/sbin/nginx* /usr/sbin/ |
| 15 | +COPY --from=nginx_stable /usr/lib/nginx /usr/lib/nginx |
| 16 | +COPY --from=nginx_stable /etc/nginx /etc/nginx |
| 17 | +COPY files / |
| 18 | + |
| 19 | +FROM php:${VERSION}${FLAVOUR} |
| 20 | +WORKDIR /var/www |
| 21 | + |
| 22 | +ENV \ |
| 23 | + PHP_EXTENSIONS="bcmath calendar exif gettext imagick intl mysqli opcache pcntl pdo_mysql redis soap sockets xdebug zip" \ |
| 24 | + EXTRA_PACKAGES="unzip mysql-client nano joe vim" \ |
| 25 | + DOCKER_USER="www-data:www-data" |
| 26 | + |
| 27 | +COPY --from=overlay / / |
| 28 | + |
| 29 | +RUN set -eux; \ |
| 30 | + chmod u+s,g+s /usr/bin/docker-user-init; \ |
| 31 | + install-php-extensions ${PHP_EXTENSIONS}; \ |
| 32 | + pkg-install pcre shadow dumb-init bash ${EXTRA_PACKAGES}; \ |
| 33 | + pkg-purge ${PHPIZE_DEPS}; \ |
| 34 | + pkg-cleanup; \ |
| 35 | + composer global require hirak/prestissimo; \ |
| 36 | + cp -a /usr/local/etc/php/* /etc/php/; \ |
| 37 | + rm -f /etc/php/conf.d/docker-php-ext-xdebug.ini; \ |
| 38 | + mv /etc/php/php.ini-production /etc/php/php.ini; \ |
| 39 | + rm -rf /var/www/*; \ |
| 40 | + mkdir /home/www; \ |
| 41 | + chown -R -h ${DOCKER_USER} /home/www /var/www; |
| 42 | + |
| 43 | +USER ${DOCKER_USER} |
| 44 | +ENTRYPOINT ["/usr/bin/docker-user-init", "--"] |
| 45 | +CMD ["php-fpm"] |
0 commit comments