@@ -5,8 +5,6 @@ ARG GID=1008
55
66WORKDIR /var/www/html
77
8- VOLUME /var/www/html/var
9-
108# Update package list and install system dependencies
119RUN apt-get update \
1210 && apt-get install -y --no-install-recommends \
@@ -26,7 +24,7 @@ RUN groupadd -g ${GID} localUser && \
2624ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
2725
2826RUN set -eux; \
29- install-php-extensions @composer zip intl pdo_mysql mysqli gd opcache pcntl \
27+ install-php-extensions @composer-2.2.25 zip intl pdo_mysql mysqli gd opcache pcntl \
3028 ;
3129
3230COPY --link .docker/php/conf.d/10-app.ini $PHP_INI_DIR/conf.d/
@@ -36,31 +34,33 @@ HEALTHCHECK --start-period=1m CMD docker-healthcheck
3634
3735COPY --link --chmod=755 .docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
3836
39- COPY --link .docker/apache/apache.conf /etc/apache2/sites-available/000-default.conf
40- COPY --link .docker/apache/cert/apache.crt /etc/apache2/ssl/apache.crt
41- COPY --link .docker/apache/cert/apache.key /etc/apache2/ssl/apache.key
42-
43- RUN sed --in-place "s/User \$ {APACHE_RUN_USER}/User localUser/" /etc/apache2/apache2.conf && \
44- sed --in-place "s/Group \$ {APACHE_RUN_GROUP}/Group localUser/" /etc/apache2/apache2.conf && \
45- a2ensite 000-default && \
46- a2enmod rewrite ssl
47-
4837ENTRYPOINT ["docker-entrypoint" ]
4938CMD ["apache2-foreground" ]
5039
5140FROM afup_web_base AS afup_web_dev
5241
53- ENV APP_ENV=dev
54-
5542COPY --link .docker/php/conf.d/20-app.dev.ini $PHP_INI_DIR/conf.d/
5643
5744RUN set -eux; \
5845 install-php-extensions xdebug \
5946 ;
6047
61- FROM afup_web_base AS afup_web_prod
48+ COPY --link .docker/apache/apache.conf /etc/apache2/sites-available/000-default.conf
49+ COPY --link .docker/apache/cert/apache.crt /etc/apache2/ssl/apache.crt
50+ COPY --link .docker/apache/cert/apache.key /etc/apache2/ssl/apache.key
51+
52+ RUN sed --in-place "s/User \$ {APACHE_RUN_USER}/User localUser/" /etc/apache2/apache2.conf && \
53+ sed --in-place "s/Group \$ {APACHE_RUN_GROUP}/Group localUser/" /etc/apache2/apache2.conf && \
54+ a2ensite 000-default && \
55+ a2enmod rewrite ssl
56+
57+ FROM afup_web_base AS afup_web_prod_base
58+
59+ VOLUME /var/www/html/var
6260
6361ENV APP_ENV=prod
62+ ENV SYMFONY_ENV=prod
63+ ENV COMPOSER_ALLOW_SUPERUSER=1
6464
6565RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
6666COPY --link .docker/php/conf.d/20-app.prod.ini $PHP_INI_DIR/conf.d/
@@ -76,9 +76,8 @@ RUN set -eux; \
7676COPY --link . ./
7777
7878RUN set -eux; \
79- mkdir -p var/cache var/log var/sessions; \
79+ mkdir -p var/cache var/logs var/sessions; \
8080 composer dump-autoload --classmap-authoritative --no-dev; \
81- composer dump-env prod; \
8281 composer run-script --no-dev post-install-cmd; \
8382 chmod +x bin/console; sync;
8483
@@ -88,11 +87,18 @@ WORKDIR /var/www/html
8887
8988COPY --link ./package.json ./package-lock.json ./webpack.config.js ./
9089
91- COPY --from=afup_web_prod ./var/www/html/htdocs ./htdocs
92- COPY --from=afup_web_prod ./var/www/html/vendor ./vendor
90+ COPY --from=afup_web_prod_base ./var/www/html/htdocs ./htdocs
91+ COPY --from=afup_web_prod_base ./var/www/html/sources ./sources
92+
93+ COPY --from=afup_web_prod_base ./var/www/html/vendor ./vendor
9394
9495ENV NODE_ENV=prod
9596
9697RUN set -eux; \
9798 npm install --legacy-peer-deps; \
98- npm run build;
99+ npm run build;
100+
101+ FROM afup_web_prod_base AS afup_web_prod
102+
103+ COPY --from=afup_web_assets ./var/www/html/htdocs ./htdocs
104+ COPY --from=afup_web_assets ./var/www/html/sources ./sources
0 commit comments