-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Dockerfile-8.1
107 lines (88 loc) · 3 KB
/
Dockerfile-8.1
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
102
103
104
105
106
107
# vi: ft=dockerfile
# Auto-generated via Ansible: edit ./ansible/DOCKERFILES/Dockerfile-base.j2 instead.
FROM devilbox/php-fpm-8.1
MAINTAINER "cytopia" <[email protected]>
###
### Labels
###
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
#LABEL "org.opencontainers.image.created"=""
#LABEL "org.opencontainers.image.version"=""
#LABEL "org.opencontainers.image.revision"=""
LABEL "maintainer"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.authors"="cytopia <[email protected]>"
LABEL "org.opencontainers.image.url"="https://github.com/devilbox/docker-php-fpm"
LABEL "org.opencontainers.image.documentation"="https://github.com/devilbox/docker-php-fpm"
LABEL "org.opencontainers.image.source"="https://github.com/devilbox/docker-php-fpm"
LABEL "org.opencontainers.image.vendor"="devilbox"
LABEL "org.opencontainers.image.licenses"="MIT"
LABEL "org.opencontainers.image.ref.name"="8.1-base"
LABEL "org.opencontainers.image.title"="PHP-FPM 8.1-base"
LABEL "org.opencontainers.image.description"="PHP-FPM 8.1-base"
###
### Envs
###
ENV MY_USER="devilbox" \
MY_GROUP="devilbox" \
MY_UID="1000" \
MY_GID="1000" \
PHP_VERSION="8.1"
###
### User/Group
###
RUN set -eux \
&& groupadd -g ${MY_GID} -r ${MY_GROUP} \
&& useradd -u ${MY_UID} -m -s /bin/bash -g ${MY_GROUP} ${MY_USER}
###
### Upgrade (install ps)
###
RUN set -eux \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
dpkg-dev \
procps \
&& rm -rf /var/lib/apt/lists/*
###
### Configure
###
RUN set -eux \
&& rm -rf /usr/local/etc/php-fpm.d \
&& mkdir -p /usr/local/etc/php-fpm.d \
&& mkdir -p /var/lib/php/session \
&& mkdir -p /var/lib/php/wsdlcache \
&& chown -R devilbox:devilbox /var/lib/php/session \
&& chown -R devilbox:devilbox /var/lib/php/wsdlcache
###
### Copy files
###
COPY ./data/php-ini.d/php-8.1.ini /usr/local/etc/php/conf.d/xxx-devilbox-default-php.ini
COPY ./data/php-fpm.conf/php-fpm-8.1.conf /usr/local/etc/php-fpm.conf
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
###
### Verify
###
RUN set -eux \
&& echo "date.timezone=UTC" > /usr/local/etc/php/php.ini \
&& php -v | grep -oE 'PHP\s[.0-9]+' | grep -oE '[.0-9]+' | grep '^8.1' \
&& /usr/local/sbin/php-fpm --test \
\
&& PHP_ERROR="$( php -v 2>&1 1>/dev/null )" \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \
&& PHP_ERROR="$( php -i 2>&1 1>/dev/null )" \
&& if [ -n "${PHP_ERROR}" ]; then echo "${PHP_ERROR}"; false; fi \
\
&& PHP_FPM_ERROR="$( php-fpm -v 2>&1 1>/dev/null )" \
&& if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \
&& PHP_FPM_ERROR="$( php-fpm -i 2>&1 1>/dev/null )" \
&& if [ -n "${PHP_FPM_ERROR}" ]; then echo "${PHP_FPM_ERROR}"; false; fi \
&& rm -f /usr/local/etc/php/php.ini
###
### Ports
###
EXPOSE 9000
###
### Entrypoint
###
CMD ["/usr/local/sbin/php-fpm"]
ENTRYPOINT ["/docker-entrypoint.sh"]