This repository has been archived by the owner on May 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile.7.4
197 lines (180 loc) · 4.68 KB
/
Dockerfile.7.4
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
FROM alpine:3.13
ARG BUILD_CORES
ARG NGINX_VER=1.19.8
ARG PHP_VER=7.4.16
ARG LIBICONV_VERSION=1.16
LABEL description="nginx + php image based on Alpine" \
maintainer="Wonderfall <[email protected]>" \
php_version="PHP v$PHP_VER built from source" \
nginx_version="nginx v$NGINX_VER built from source"
ARG PHP_MIRROR=http://ch1.php.net
ARG NGINX_CONF=" \
--prefix=/nginx \
--sbin-path=/usr/local/sbin/nginx \
--http-log-path=/nginx/logs/access.log \
--error-log-path=/nginx/logs/error.log \
--pid-path=/nginx/run/nginx.pid \
--lock-path=/nginx/run/nginx.lock \
--with-threads \
--with-file-aio \
--without-http_geo_module \
--without-http_autoindex_module \
--without-http_split_clients_module \
--without-http_memcached_module \
--without-http_empty_gif_module \
--without-http_browser_module"
ARG PHP_CONF=" \
--prefix=/usr \
--libdir=/usr/lib/php \
--datadir=/usr/share/php \
--sysconfdir=/php/etc \
--localstatedir=/php/var \
--with-pear=/usr/share/php \
--with-config-file-scan-dir=/php/conf.d \
--with-config-file-path=/php \
--with-pic \
--disable-short-tags \
--without-readline \
--enable-bcmath=shared \
--enable-fpm \
--disable-cgi \
--enable-mysqlnd \
--enable-mbstring \
--with-curl \
--with-libedit \
--with-openssl \
--with-iconv=/usr/local \
--enable-gd \
--with-freetype \
--with-jpeg \
--with-webp-dir \
--with-xpm-dir=no \
--enable-gd-native-ttf \
--disable-gd-jis-conv \
--enable-bcmath \
--with-zlib"
ARG PHP_EXT_LIST=" \
mysqli \
ctype \
dom \
json \
xml \
mbstring \
posix \
xmlwriter \
zip \
zlib \
sqlite3 \
pdo_sqlite \
pdo_pgsql \
pdo_mysql \
pcntl \
curl \
fileinfo \
bz2 \
intl \
openssl \
ldap \
simplexml \
pgsql \
ftp \
exif \
gmp \
imap"
ARG CUSTOM_BUILD_PKGS=" \
freetype-dev \
openldap-dev \
gmp-dev \
icu-dev \
postgresql-dev \
libpng-dev \
libwebp-dev \
gd-dev \
libjpeg-turbo-dev \
libxpm-dev \
libedit-dev \
libxml2-dev \
openssl-dev \
libbz2 \
sqlite-dev \
imap-dev"
ARG CUSTOM_PKGS=" \
freetype \
openldap \
gmp \
bzip2-dev \
icu \
libpq \
c-client"
COPY rootfs /
RUN NB_CORES=${BUILD_CORES-$(getconf _NPROCESSORS_CONF)} \
### Packages installation
&& BUILD_DEPS=" \
linux-headers \
libtool \
build-base \
pcre-dev \
zlib-dev \
wget \
gnupg \
autoconf \
gcc \
g++ \
libc-dev \
libzip-dev \
make \
pkgconf \
curl-dev \
ca-certificates \
oniguruma-dev \
${CUSTOM_BUILD_PKGS}" \
&& apk -U add \
${BUILD_DEPS} \
s6 \
su-exec \
curl \
libedit \
libxml2 \
oniguruma \
openssl \
libwebp \
libzip \
sqlite-libs \
gd \
pcre \
zlib \
${CUSTOM_PKGS} \
### Source downloading
&& wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz -O /tmp/nginx-${NGINX_VER}.tar.gz \
&& wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz.asc -O /tmp/nginx-${NGINX_VER}.tar.gz.asc \
&& wget ${PHP_MIRROR}/get/php-${PHP_VER}.tar.gz/from/this/mirror -O /tmp/php-${PHP_VER}.tar.gz \
&& wget ${PHP_MIRROR}/get/php-${PHP_VER}.tar.gz.asc/from/this/mirror -O /tmp/php-${PHP_VER}.tar.gz.asc \
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz -O /tmp/libiconv-${LIBICONV_VERSION}.tar.gz \
&& mkdir -p /php/conf.d \
&& mkdir -p /usr/src \
&& tar xzf /tmp/nginx-${NGINX_VER}.tar.gz -C /usr/src \
&& tar xzvf /tmp/php-${PHP_VER}.tar.gz -C /usr/src \
&& tar xzf /tmp/libiconv-${LIBICONV_VERSION}.tar.gz -C /usr/src \
### nginx installation
&& cd /usr/src/nginx-${NGINX_VER} \
&& ./configure --with-cc-opt="-O3 -fPIE -fstack-protector-strong" ${NGINX_CONF} \
&& make -j ${NB_CORES} \
&& make install \
### GNU Libiconv installation
&& cd /usr/src/libiconv-${LIBICONV_VERSION} \
&& ./configure --prefix=/usr/local \
&& make && make install && libtool --finish /usr/local/lib \
### PHP installation
&& mv /usr/src/php-${PHP_VER} /usr/src/php \
&& cd /usr/src/php \
&& ./configure CFLAGS="-O3 -fstack-protector-strong" ${PHP_CONF} \
&& make -j ${NB_CORES} \
&& make install \
### Strip, clean, install modules
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
&& make clean \
&& chmod u+x /usr/local/bin/* /etc/s6.d/*/* \
&& docker-php-ext-install ${PHP_EXT_LIST} \
&& apk del ${BUILD_DEPS} \
&& rm -rf /tmp/* /var/cache/apk/* /usr/src/* \
&& mkdir -p /nginx/logs /nginx/run /php/php-fpm.d /php/logs /php/run /php/session