11# syntax=docker/dockerfile:1.4
2+
23# Adapted from https://github.com/dunglas/symfony-docker
34
5+ # The different stages of this Dockerfile are meant to be built into separate images
6+ # https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
7+ # https://docs.docker.com/compose/compose-file/#target
8+
9+
10+ # Build Caddy with the Mercure and Vulcain modules
11+ # Temporary fix for https://github.com/dunglas/mercure/issues/770
12+ FROM caddy:2.7-builder-alpine AS app_caddy_builder
13+
14+ RUN xcaddy build v2.6.4 \
15+ --with github.com/dunglas/mercure/caddy \
16+ --with github.com/dunglas/vulcain/caddy
17+
418# Prod image
519FROM php:8.2-fpm-alpine AS app_php
620
@@ -9,9 +23,10 @@ ENV APP_ENV=prod
923WORKDIR /srv/app
1024
1125# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
12- COPY --from=mlocati/php-extension-installer --link /usr/bin/install-php-extensions /usr/local/bin/
26+ COPY --from=mlocati/php-extension-installer:latest --link /usr/bin/install-php-extensions /usr/local/bin/
1327
1428# persistent / runtime deps
29+ # hadolint ignore=DL3018
1530RUN apk add --no-cache \
1631 acl \
1732 fcgi \
@@ -22,10 +37,10 @@ RUN apk add --no-cache \
2237
2338RUN set -eux; \
2439 install-php-extensions \
25- intl \
26- zip \
27- apcu \
40+ apcu \
41+ intl \
2842 opcache \
43+ zip \
2944 ;
3045
3146# ##> recipes ###
@@ -60,47 +75,41 @@ ENV PATH="${PATH}:/root/.composer/vendor/bin"
6075COPY --from=composer/composer:2-bin --link /composer /usr/bin/composer
6176
6277# prevent the reinstallation of vendors at every changes in the source code
63- COPY composer.* symfony.* ./
78+ COPY --link composer.* symfony.* ./
6479RUN set -eux; \
6580 composer install --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress; \
6681 composer clear-cache
6782
6883# copy sources
69- COPY --link . .
84+ COPY --link . ./
7085RUN rm -Rf docker/
7186
7287RUN set -eux; \
7388 mkdir -p var/cache var/log; \
7489 composer dump-autoload --classmap-authoritative --no-dev; \
7590 composer dump-env prod; \
7691 composer run-script --no-dev post-install-cmd; \
77- chmod +x bin/console; sync
92+ chmod +x bin/console; sync;
7893
7994# Dev image
8095FROM app_php AS app_php_dev
8196
8297ENV APP_ENV=dev XDEBUG_MODE=off
8398VOLUME /srv/app/var/
8499
85- RUN rm $PHP_INI_DIR/conf.d/app.prod.ini; \
100+ RUN rm " $PHP_INI_DIR/conf.d/app.prod.ini" ; \
86101 mv "$PHP_INI_DIR/php.ini" "$PHP_INI_DIR/php.ini-production" ; \
87102 mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
88103
89104COPY --link docker/php/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
90105
91106RUN set -eux; \
92- install-php-extensions xdebug
107+ install-php-extensions \
108+ xdebug \
109+ ;
93110
94111RUN rm -f .env.local.php
95112
96- # Build Caddy with the Mercure and Vulcain modules
97- # Temporary fix for https://github.com/dunglas/mercure/issues/770
98- FROM caddy:2.7-builder-alpine AS app_caddy_builder
99-
100- RUN xcaddy build v2.6.4 \
101- --with github.com/dunglas/mercure/caddy \
102- --with github.com/dunglas/vulcain/caddy
103-
104113# Caddy image
105114FROM caddy:2-alpine AS app_caddy
106115
0 commit comments