-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.prod
60 lines (35 loc) · 1.26 KB
/
Dockerfile.prod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM php:7.3.3-fpm-alpine as base
WORKDIR /var/www
# Override Docker configuration: listen on Unix socket instead of TCP
RUN sed -i "s|listen = 9000|listen = /var/run/php/fpm.sock\nlisten.mode = 0666|" /usr/local/etc/php-fpm.d/zz-docker.conf
# Install dependencies
RUN set -xe \
&& apk add --no-cache bash icu-dev postgresql-dev \
&& docker-php-ext-install pdo pdo_pgsql intl pcntl
COPY docker/php/uploads.ini /usr/local/etc/php/conf.d/uploads.ini
CMD ["php-fpm"]
FROM composer:1.8.4 as composer
RUN rm -rf /var/www && mkdir /var/www
WORKDIR /var/www
COPY composer.* /var/www/
ARG APP_ENV=prod
RUN set -xe \
&& if [ "$APP_ENV" = "prod" ]; then export ARGS="--no-dev"; fi \
&& composer install --prefer-dist --no-scripts --no-progress --no-suggest --no-interaction $ARGS
COPY . /var/www
RUN composer dump-autoload --classmap-authoritative
FROM node:12.21.0 as node
RUN rm -rf /var/www && mkdir /var/www
WORKDIR /var/www
COPY --from=composer /var/www/ /var/www/
RUN yarn install
RUN yarn build
FROM base
ARG APP_ENV=prod
ARG APP_DEBUG=0
ENV APP_ENV $APP_ENV
ENV APP_DEBUG $APP_DEBUG
COPY --from=node /var/www/ /var/www/
# Memory limit increase is required by the dev image
RUN php -d memory_limit=256M bin/console cache:clear
RUN bin/console assets:install