generated from Runroom/archetype-symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (49 loc) · 1.84 KB
/
Dockerfile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# BASE
FROM php:8.0-fpm-buster as base
WORKDIR /usr/app
COPY --from=mlocati/php-extension-installer:latest /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions apcu bz2 gd intl opcache pdo_mysql zip
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
unzip \
mariadb-client \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
ENV PATH="/usr/app/vendor/bin:/usr/app/bin:${PATH}"
RUN mv $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY .docker/app-prod/extra.ini /usr/local/etc/php/conf.d/extra.ini
COPY .docker/app-prod/www.conf /usr/local/etc/php-fpm.d/www.conf
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# NODE-PROD
FROM node:14-buster as node-prod
WORKDIR /usr/app
COPY .yarn /usr/app/.yarn
COPY .yarnrc.yml /usr/app/yarnrc.yml
COPY package.json /usr/app/package.json
COPY yarn.lock /usr/app/yarn.lock
RUN yarn install --immutable
COPY webpack.config.js /usr/app/webpack.config.js
COPY .babelrc /usr/app/.babelrc
COPY .browserslistrc /usr/app/.browserslistrc
COPY .eslintrc /usr/app/.eslintrc
COPY .stylelintrc /usr/app/.stylelintrc
COPY postcss.config.js /usr/app/postcss.config.js
COPY assets /usr/app/assets
RUN yarn encore production
# FPM-PROD
FROM base as fpm-prod
COPY .env /usr/app/.env
COPY composer.json /usr/app/composer.json
COPY composer.lock /usr/app/composer.lock
COPY symfony.lock /usr/app/symfony.lock
RUN composer install --prefer-dist --no-progress --no-interaction --no-dev
COPY . /usr/app
RUN composer dump-autoload --classmap-authoritative
RUN composer symfony:dump-env prod
COPY --from=node-prod /usr/app/public/build /usr/app/public/build
ENTRYPOINT ["bash", "/usr/app/.docker/app-prod/php-fpm.sh"]
# FPM-DEV
FROM base as fpm-dev
RUN install-php-extensions pcov xdebug
CMD ["php-fpm", "--allow-to-run-as-root"]