This repository has been archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
79 lines (62 loc) · 2.1 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
FROM samjarrett/php-toolkit AS php_dependencies
WORKDIR /source
RUN set -xe && \
apk add --no-cache --virtual .build-deps git && \
true
COPY composer.json composer.lock /source/
RUN set -xe && \
composer install --no-scripts --no-progress --no-suggest --prefer-dist --no-autoloader && \
true
########################################################################################################################
FROM node:alpine AS node_dependencies
ENV NODE_ENV=production
WORKDIR /source
### If we had a front-end build chain, we would install and compile our assets like this:
#RUN set -xe && \
# apk add --no-cache --virtual .build-deps git gzip && \
# true
#
#COPY package.json yarn.lock /source/
#RUN set -xe && \
# yarn --production && \
# true
#
#COPY webpack.config.js postcss.config.js .babelrc /source/
#COPY design /source/design
#
#RUN set -xe && \
# yarn run build && \
# true
### Instead, just copy some rando files to the web directory to simulate a front-end build
COPY design /source/design
RUN set -xe && \
mkdir -p web/assets && \
cp -r design/* web/assets/ && \
true
########################################################################################################################
FROM samjarrett/php-toolkit
ENV FPM_PROCESS_MANAGER=ondemand \
PHP_TIMEZONE="Australia/Melbourne" \
SYMFONY_ENV=prod \
SYMFONY_DEBUG=0 \
DATABASE_HOST=db
COPY config/php-fpm/docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
WORKDIR /app
# Bring in installed PHP deps
COPY --from=php_dependencies /source/vendor /app/vendor
COPY --from=php_dependencies /source/composer.json /source/composer.lock /app/
COPY bin /app/bin
COPY web /app/web
COPY src /app/src
COPY app /app/app
RUN set -xe && \
composer dump-autoload --optimize --classmap-authoritative && \
mkdir -p var/cache var/logs var/sessions && \
composer run-script post-install-cmd --no-interaction && \
chown -R www-data var && \
rm -rf var/logs/* && \
true
# Bring in compiled front-end assets
COPY --from=node_dependencies /source/web /app/web