forked from parti-renaissance/espace-adherent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
101 lines (77 loc) · 2.82 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
# syntax=docker/dockerfile:1.4
# Adapted from https://github.com/dunglas/symfony-docker
ARG CADDY_VERSION=2
# Fix the version of PHP to avoid this bug https://github.com/php/php-src/issues/14480
ARG PHP_VERSION=8.3.7
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-alpine AS node
RUN apk add --no-cache git
WORKDIR /srv/app
FROM caddy:${CADDY_VERSION}-alpine AS caddy
FROM mlocati/php-extension-installer:2 AS php_extension_installer
FROM php:${PHP_VERSION}-fpm-alpine AS php_caddy
ENV TZ Europe/Paris
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR.UTF-8
ENV LC_ALL fr_FR.UTF-8
ARG BUILD_DEV
WORKDIR /srv/app
# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
COPY --link --from=php_extension_installer /usr/bin/install-php-extensions /usr/local/bin/
# persistent / runtime deps
RUN apk add --no-cache \
acl \
fcgi \
file \
gettext \
git \
multirun \
;
RUN set -eux; \
install-php-extensions \
apcu \
intl \
opcache \
mbstring \
exif \
gd \
bcmath \
pdo \
pdo_mysql \
amqp \
zip \
sockets \
;
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Europe/Paris /etc/localtime && \
echo "Europe/Paris" > /etc/timezone && \
apk del tzdata
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY --link docker/php/conf.d/default.ini $PHP_INI_DIR/conf.d/
COPY --link docker/php/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/app.ini
COPY --link docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf
RUN mkdir -p /var/run/php
COPY --link docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck
HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
COPY --link docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"
COPY --link --from=composer/composer:2-bin /composer /usr/bin/composer
COPY --link . .
RUN test -z "$BUILD_DEV" && ( \
set -eux; \
mkdir -p var/cache var/log; \
composer install --prefer-dist --no-dev --no-progress --no-scripts --no-interaction; \
composer dump-autoload --classmap-authoritative --no-dev; \
composer dump-env prod; \
composer run-script --no-dev post-install-cmd; \
rm -rf /root/.composer; \
chmod +x bin/console; sync \
) || :
COPY --link --from=caddy /usr/bin/caddy /usr/bin/caddy
COPY --link docker/caddy/Caddyfile /etc/caddy/Caddyfile
EXPOSE 80
CMD ["multirun", "docker-entrypoint php-fpm -F -R", "caddy run --config /etc/caddy/Caddyfile --adapter caddyfile"]