-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (35 loc) · 1.22 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
# Build JS and CSS assets
FROM node:10-alpine as node
ARG APP_ENV=prod
ENV APP_ENV=${APP_ENV}
RUN apk add --no-cache yarn python2
WORKDIR /var/www/app
COPY . /var/www/app
RUN yarn install \
&& yarn run encore $(if [ "x${APP_ENV}" = "xprod" ] ; then echo production; else echo ${APP_ENV};fi)
# Download PHP dependencies and build cache
FROM gmaiztegi/nginx-php-fpm as build
ARG APP_ENV=prod
ARG APP_DEBUG=0
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY . /var/www/app
WORKDIR /var/www/app
ENV APP_ENV ${APP_ENV}
ENV APP_DEBUG ${APP_DEBUG}
RUN composer install --no-dev \
&& bin/console cache:warmup
# Lean final release image
FROM gmaiztegi/nginx-php-fpm
MAINTAINER Gorka Maiztegi <[email protected]>
ARG APP_ENV=prod
ARG APP_DEBUG=0
ENV APP_ENV ${APP_ENV}
ENV APP_DEBUG ${APP_DEBUG}
WORKDIR /var/www/app
RUN sed -i "s,root /var/www/app/\\;,root /var/www/app/public\\;," /etc/nginx/nginx.conf
COPY . /var/www/app
COPY --from=build /var/www/app/vendor /var/www/app/vendor
COPY --from=build --chown=nginx:nginx /var/www/app/var /var/www/app/var
COPY --from=node /var/www/app/public/build /var/www/app/public/build
COPY --from=build /var/www/app/public/bundles /var/www/app/public/bundles
VOLUME "/var/www/app"