-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (40 loc) · 2.4 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
ARG php="8.2"
## Base PHP images
FROM php:8.1-fpm-alpine@sha256:857e617d937d7425433a3e194594147c4553af6aeffb6d58192d1e2f78f04e8d AS php8.1
FROM php:8.2-fpm-alpine@sha256:a5f5296e2bea53697f97952eca43ebfa2f7222b4ab8b5e3833bd8131dae7c2e4 AS php8.2
FROM php:8.3-fpm-alpine@sha256:70ea1d9751ada0701e7f2a84d0b40ace06947847e0a539d56c3911501e94364a AS php8.3
FROM php:8.4-fpm-alpine@sha256:63df51700902493131ac4235f368fee3f5da668b25441167ae58c113a3587516 AS php8.4
## Helper images
FROM blackfire/blackfire:2@sha256:1df0d05684ae180dc37a139d8bf01485fdbc37f654ef91ccbdb8072172110daa AS blackfire
FROM composer:2@sha256:26bbf85fccb36247181de6f4a2beddac47d4b352c0c19249a3b4fa2abf1e38ad AS composer
FROM mlocati/php-extension-installer:2@sha256:a03e1f1ededfdb90231320fb214483199c0b7173f52aaafdb9c0ad66f1b83ed6 AS php-extension-installer
## Custom PHP image
# hadolint ignore=DL3006
FROM php${php}
ARG php=${php}
ARG php_enable_extensions="apcu bcmath calendar ctype curl dom exif fileinfo ftp gd gettext iconv imagick intl json mbstring memcache memcached mysqli mysqlnd opcache pdo pdo_mysql pdo_sqlite phar posix readline redis shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl zip"
ARG php_install_extensions="blackfire xdebug"
HEALTHCHECK --interval=10s --start-period=90s CMD netstat -ltn | grep -c ":9000"
COPY context/ /
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/bin
RUN <<EOT
set -eux
apk add --no-cache bash=~5 git=~2 jq=~1 mariadb-client=~11 msmtp=~1 patch=~2 unzip=~6 graphicsmagick=~1 sudo=~1 tini=~0
install-php-extensions ${php_enable_extensions}
if [ "${php}" != "8.4" ]; then IPE_DONT_ENABLE=1 install-php-extensions ${php_install_extensions}; fi
adduser -H -D -S -G wheel -u 501 machost
adduser -H -D -S -G wheel -u 1000 linuxhost
EOT
COPY --from=blackfire /usr/local/bin/blackfire /usr/bin
COPY --from=composer /usr/bin/composer /usr/bin
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
RUN curl https://endoflife.date/api/php/${php}.json| jq '{support,eol,lts}' > /etc/eol.json
ARG workdir=/var/www
WORKDIR "${workdir}"
ENV COMPOSER_CACHE_DIR="/tmp/composer-cache"
ENV GIT_CEILING_DIRECTORIES="${workdir}"
ENV PATH="${workdir}/vendor/bin:${PATH}"
ENV PHP_DOCUMENT_ROOT="${workdir}/web"
ENV PHP_SENDMAIL_PATH="/usr/bin/msmtp --read-recipients --read-envelope-from"
ENTRYPOINT [ "/sbin/tini", "--", "php-fpm-entrypoint" ]
CMD [ "php-fpm" ]