-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
53 lines (40 loc) · 2.39 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.3"
## Base PHP images
FROM php:8.1-fpm-alpine@sha256:9c7192c33f930d7f0edc9d89ca75119af0a7a5281b510230b63530136cd6405a AS php8.1
FROM php:8.2-fpm-alpine@sha256:e4e0b8a028bfd14b5bf8b75dfa3b9ad563ea03c05a192b8ca4a0b2fed6f7a3cd AS php8.2
FROM php:8.3-fpm-alpine@sha256:3ebbe25803556a210e1d4da0f9c8bd604cc56f9872c2c6408095a85672a58e41 AS php8.3
FROM php:8.4-fpm-alpine@sha256:a80eef89bdd993a4a3980f575a1d6ad79e0282cf5c57ddf00499e7372034a11f AS php8.4
## Helper images
FROM blackfire/blackfire:2@sha256:bc34d45dcd7c7e2ae5ef9a282f7c0145e03d6bf7907522b8f56fa4a090798587 AS blackfire
FROM composer:2@sha256:26bbf85fccb36247181de6f4a2beddac47d4b352c0c19249a3b4fa2abf1e38ad AS composer
FROM mlocati/php-extension-installer:2@sha256:c30feccf146a308be5c7e08019560dc686682cb66ef23f8c00a242fd5ceb644f 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"
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 blackfire; fi
IPE_DONT_ENABLE=1 install-php-extensions xdebug
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" ]