1
+ #
2
+ # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
3
+ #
4
+ # PLEASE DO NOT EDIT IT DIRECTLY.
5
+ #
6
+
7
+ FROM alpine:3.4
8
+
9
+ # persistent / runtime deps
10
+ ENV PHPIZE_DEPS \
11
+ autoconf \
12
+ file \
13
+ g++ \
14
+ gcc \
15
+ libc-dev \
16
+ make \
17
+ pkgconf \
18
+ re2c
19
+ RUN apk add --no-cache --virtual .persistent-deps \
20
+ ca-certificates \
21
+ curl \
22
+ tar \
23
+ xz
24
+
25
+ # ensure www-data user exists
26
+ RUN set -x \
27
+ && addgroup -g 82 -S www-data \
28
+ && adduser -u 82 -D -S -G www-data www-data
29
+ # 82 is the standard uid/gid for "www-data" in Alpine
30
+ # http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
31
+ # http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
32
+ # http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
33
+
34
+ ENV PHP_INI_DIR /usr/local/etc/php
35
+ RUN mkdir -p $PHP_INI_DIR/conf.d
36
+
37
+ # #<autogenerated>##
38
+ ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
39
+ # #</autogenerated>##
40
+
41
+ ENV GPG_KEYS F38252826ACD957EF380D39F2F7956BC5DA04B5D
42
+
43
+ ENV PHP_VERSION 5.4.45
44
+ ENV PHP_URL="https://secure.php.net/get/php-5.4.45.tar.gz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-5.4.45.tar.gz.asc/from/this/mirror"
45
+ ENV PHP_SHA256="" PHP_MD5="ba580e774ed1ab256f22d1fa69a59311"
46
+
47
+ RUN set -xe; \
48
+ \
49
+ apk add --no-cache --virtual .fetch-deps \
50
+ gnupg \
51
+ openssl \
52
+ ; \
53
+ \
54
+ mkdir -p /usr/src; \
55
+ cd /usr/src; \
56
+ \
57
+ wget -O php.tar.gz "$PHP_URL" ; \
58
+ \
59
+ if [ -n "$PHP_SHA256" ]; then \
60
+ echo "$PHP_SHA256 *php.tar.gz" | sha256sum -c -; \
61
+ fi; \
62
+ if [ -n "$PHP_MD5" ]; then \
63
+ echo "$PHP_MD5 *php.tar.gz" | md5sum -c -; \
64
+ fi; \
65
+ \
66
+ if [ -n "$PHP_ASC_URL" ]; then \
67
+ wget -O php.tar.gz.asc "$PHP_ASC_URL" ; \
68
+ export GNUPGHOME="$(mktemp -d)" ; \
69
+ for key in $GPG_KEYS; do \
70
+ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
71
+ done; \
72
+ gpg --batch --verify php.tar.gz.asc php.tar.gz; \
73
+ rm -r "$GNUPGHOME" ; \
74
+ fi; \
75
+ \
76
+ apk del .fetch-deps
77
+
78
+ COPY docker-php-source /usr/local/bin/
79
+
80
+ RUN set -xe \
81
+ && apk add --no-cache --virtual .build-deps \
82
+ $PHPIZE_DEPS \
83
+ curl-dev \
84
+ libedit-dev \
85
+ libxml2-dev \
86
+ openssl-dev \
87
+ sqlite-dev \
88
+ \
89
+ && docker-php-source extract \
90
+ && cd /usr/src/php \
91
+ && ./configure \
92
+ --with-config-file-path="$PHP_INI_DIR" \
93
+ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
94
+ \
95
+ --disable-cgi \
96
+ \
97
+ # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
98
+ --enable-ftp \
99
+ # --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
100
+ --enable-mbstring \
101
+ # --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
102
+ --enable-mysqlnd \
103
+ \
104
+ --with-curl \
105
+ --with-libedit \
106
+ --with-openssl \
107
+ --with-zlib \
108
+ \
109
+ $PHP_EXTRA_CONFIGURE_ARGS \
110
+ && make -j "$(getconf _NPROCESSORS_ONLN)" \
111
+ && make install \
112
+ && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
113
+ && make clean \
114
+ && docker-php-source delete \
115
+ \
116
+ && runDeps="$( \
117
+ scanelf --needed --nobanner --recursive /usr/local \
118
+ | awk '{ gsub(/,/, " \n so:", $2); print " so:" $2 }' \
119
+ | sort -u \
120
+ | xargs -r apk info --installed \
121
+ | sort -u \
122
+ )" \
123
+ && apk add --no-cache --virtual .php-rundeps $runDeps \
124
+ \
125
+ && apk del .build-deps
126
+
127
+ COPY docker-php-ext-* /usr/local/bin/
128
+
129
+ # #<autogenerated>##
130
+ WORKDIR /var/www/html
131
+
132
+ RUN set -ex \
133
+ && cd /usr/local/etc \
134
+ && if [ -d php-fpm.d ]; then \
135
+ # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
136
+ sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
137
+ cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
138
+ else \
139
+ # PHP 5.x don't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency
140
+ mkdir php-fpm.d; \
141
+ cp php-fpm.conf.default php-fpm.d/www.conf; \
142
+ { \
143
+ echo '[global]' ; \
144
+ echo 'include=etc/php-fpm.d/*.conf' ; \
145
+ } | tee php-fpm.conf; \
146
+ fi \
147
+ && { \
148
+ echo '[global]' ; \
149
+ echo 'error_log = /proc/self/fd/2' ; \
150
+ echo; \
151
+ echo '[www]' ; \
152
+ echo '; if we send this to /proc/self/fd/1, it never appears' ; \
153
+ echo 'access.log = /proc/self/fd/2' ; \
154
+ echo; \
155
+ echo 'clear_env = no' ; \
156
+ echo; \
157
+ echo '; Ensure worker stdout and stderr are sent to the main error log.' ; \
158
+ echo 'catch_workers_output = yes' ; \
159
+ } | tee php-fpm.d/docker.conf \
160
+ && { \
161
+ echo '[global]' ; \
162
+ echo 'daemonize = no' ; \
163
+ echo; \
164
+ echo '[www]' ; \
165
+ echo 'listen = [::]:9000' ; \
166
+ } | tee php-fpm.d/zz-docker.conf
167
+
168
+ EXPOSE 9000
169
+ CMD ["php-fpm" ]
170
+ # #</autogenerated>##
171
+
172
+ RUN docker-php-ext-install mysqli
173
+ RUN apk upgrade --update && apk add \
174
+ coreutils \
175
+ freetype-dev \
176
+ libjpeg-turbo-dev \
177
+ libltdl \
178
+ libmcrypt-dev \
179
+ libpng-dev \
180
+ && docker-php-ext-install -j$(nproc) iconv mcrypt \
181
+ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
182
+ && docker-php-ext-install -j$(nproc) gd
0 commit comments