forked from akeneo/demo-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
107 lines (82 loc) · 2.63 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
FROM php:8.1.1-apache AS core
RUN apt-get update \
&& apt-get install -y \
libicu-dev \
libonig-dev \
&& docker-php-ext-install \
bcmath \
intl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& mv /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
COPY ./docker/php/php.ini /usr/local/etc/php/conf.d/000-docker.ini
COPY ./docker/apache/apache2.conf /etc/apache2/apache2.conf
COPY ./docker/apache/ports.conf /etc/apache2/ports.conf
COPY ./docker/apache/app.conf /etc/apache2/sites-available/000-default.conf
###############################################################################
FROM core AS dev-tools
ENV COMPOSER_HOME=/tmp
RUN apt-get update \
&& apt-get install -y \
git \
unzip \
curl \
nodejs \
npm \
&& npm install -g yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
COPY ./docker/composer/php.ini /usr/local/etc/php/conf.d/custom.ini
###############################################################################
FROM dev-tools AS vendors
WORKDIR /srv/app
COPY composer.json composer.lock symfony.lock ./
RUN composer install \
--no-scripts \
--no-interaction \
--no-ansi \
--prefer-dist \
--optimize-autoloader \
--no-dev
###############################################################################
FROM dev-tools AS frontend
WORKDIR /srv/app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY assets assets
COPY webpack.config.js tsconfig.json ./
RUN yarn build
###############################################################################
FROM core AS production
ARG APP_ENV=prod
ARG USER=www-data
RUN mkdir -p /srv/app && chown $USER /srv/app
WORKDIR /srv/app
USER $USER
ENV APP_ENV=$APP_ENV
COPY --from=vendors /srv/app/vendor vendor
COPY --from=frontend /srv/app/public/build public/build
COPY bin bin
COPY config config
COPY public/index.php public/index.php
COPY public/favicon.ico public/favicon.ico
COPY src src
COPY templates templates
COPY translations translations
COPY .env.dist .env.dist
RUN cp -n .env.dist .env \
&& php bin/console cache:warmup \
&& php bin/console assets:install public
###############################################################################
FROM dev-tools as development
ARG USER=www-data
RUN pecl install \
xdebug \
pcov \
&& docker-php-ext-enable \
xdebug \
pcov
RUN mkdir -p /srv/app && chown $USER /srv/app
WORKDIR /srv/app
USER $USER