-
Notifications
You must be signed in to change notification settings - Fork 0
/
php-nginx-base.Dockerfile
79 lines (69 loc) · 2.36 KB
/
php-nginx-base.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 php:8.1.3-fpm-alpine3.15
php:7.4-fpm-alpine3.16
ENV NGINX_VERSION 1.20.2
ENV NJS_VERSION 0.7.0
ENV PKG_RELEASE 1
# install necessary alpine packages
RUN apk update && apk add --no-cache \
zip \
unzip \
dos2unix \
supervisor \
libpng-dev \
libzip-dev \
freetype-dev \
$PHPIZE_DEPS \
libjpeg-turbo-dev
# compile native PHP packages
RUN docker-php-ext-install \
gd \
pcntl \
bcmath \
Ctype \
JSON \
Mbstring \
OpenSSL \
PDO \
Tokenizer \
XML \
zip \
fileinfo \
sodium \
mysqli \
pdo_mysql
# configure packages
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
# install additional packages from PECL
RUN pecl install zip && docker-php-ext-enable zip \
&& pecl install igbinary && docker-php-ext-enable igbinary \
&& yes | pecl install redis && docker-php-ext-enable redis
# install nginx
RUN set -x \
&& nginxPackages=" \
nginx=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-xslt=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-geoip=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-image-filter=${NGINX_VERSION}-r${PKG_RELEASE} \
nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-r${PKG_RELEASE} \
" \
set -x \
&& KEY_SHA512="e7fa8303923d9b95db37a77ad46c68fd4755ff935d0a534d26eba83de193c76166c68bfe7f65471bf8881004ef4aa6df3e34689c305662750c0172fca5d8552a *stdin" \
&& apk add --no-cache --virtual .cert-deps \
openssl \
&& wget -O /tmp/nginx_signing.rsa.pub https://nginx.org/keys/nginx_signing.rsa.pub \
&& if [ "$(openssl rsa -pubin -in /tmp/nginx_signing.rsa.pub -text -noout | openssl sha512 -r)" = "$KEY_SHA512" ]; then \
echo "key verification succeeded!"; \
mv /tmp/nginx_signing.rsa.pub /etc/apk/keys/; \
else \
echo "key verification failed!"; \
exit 1; \
fi \
&& apk del .cert-deps \
&& apk add -X "https://nginx.org/packages/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" --no-cache $nginxPackages
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
# copy supervisor configuration
COPY ./docker/supervisord.conf /etc/supervisord.conf
EXPOSE 80
# run supervisor
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]