@@ -29,9 +29,9 @@ RUN apk add --no-cache \
2929 openssl
3030
3131# ensure www-data user exists
32- RUN set -x \
33- && addgroup -g 82 -S www-data \
34- && adduser -u 82 -D -S -G www-data www-data
32+ RUN set -eux; \
33+ addgroup -g 82 -S www-data; \
34+ adduser -u 82 -D -S -G www-data www-data
3535# 82 is the standard uid/gid for "www-data" in Alpine
3636# https://git.alpinelinux.org/aports/tree/main/apache2/apache2.pre-install?h=3.9-stable
3737# https://git.alpinelinux.org/aports/tree/main/lighttpd/lighttpd.pre-install?h=3.9-stable
@@ -66,17 +66,14 @@ ENV PHP_VERSION 7.1.30
6666ENV PHP_URL="https://www.php.net/get/php-7.1.30.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-7.1.30.tar.xz.asc/from/this/mirror"
6767ENV PHP_SHA256="6310599811536dbe87e4bcf212bf93196bdfaff519d0c821e4c0068efd096a7c" PHP_MD5=""
6868
69- RUN set -xe ; \
69+ RUN set -eux ; \
7070 \
71- apk add --no-cache --virtual .fetch-deps \
72- gnupg \
73- wget \
74- ; \
71+ apk add --no-cache --virtual .fetch-deps gnupg; \
7572 \
7673 mkdir -p /usr/src; \
7774 cd /usr/src; \
7875 \
79- wget -O php.tar.xz "$PHP_URL" ; \
76+ curl -fsSL -o php.tar.xz "$PHP_URL" ; \
8077 \
8178 if [ -n "$PHP_SHA256" ]; then \
8279 echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
@@ -86,37 +83,39 @@ RUN set -xe; \
8683 fi; \
8784 \
8885 if [ -n "$PHP_ASC_URL" ]; then \
89- wget -O php.tar.xz.asc "$PHP_ASC_URL" ; \
86+ curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL" ; \
9087 export GNUPGHOME="$(mktemp -d)" ; \
9188 for key in $GPG_KEYS; do \
9289 gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
9390 done; \
9491 gpg --batch --verify php.tar.xz.asc php.tar.xz; \
95- command -v gpgconf > /dev/null && gpgconf --kill all; \
92+ gpgconf --kill all; \
9693 rm -rf "$GNUPGHOME" ; \
9794 fi; \
9895 \
9996 apk del --no-network .fetch-deps
10097
10198COPY docker-php-source /usr/local/bin/
10299
103- RUN set -xe \
104- && apk add --no-cache --virtual .build-deps \
100+ RUN set -eux; \
101+ apk add --no-cache --virtual .build-deps \
105102 $PHPIZE_DEPS \
106103 coreutils \
107104 curl-dev \
108105 libedit-dev \
109106 libxml2-dev \
110107 openssl-dev \
111108 sqlite-dev \
109+ ; \
112110 \
113- && export CFLAGS="$PHP_CFLAGS" \
111+ export CFLAGS="$PHP_CFLAGS" \
114112 CPPFLAGS="$PHP_CPPFLAGS" \
115113 LDFLAGS="$PHP_LDFLAGS" \
116- && docker-php-source extract \
117- && cd /usr/src/php \
118- && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
119- && ./configure \
114+ ; \
115+ docker-php-source extract; \
116+ cd /usr/src/php; \
117+ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ; \
118+ ./configure \
120119 --build="$gnuArch" \
121120 --with-config-file-path="$PHP_INI_DIR" \
122121 --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
@@ -143,44 +142,45 @@ RUN set -xe \
143142# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
144143 $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit' ) \
145144 \
146- $PHP_EXTRA_CONFIGURE_ARGS \
147- && make -j "$(nproc)" \
148- && find -type f -name '*.a' -delete \
149- && make install \
150- && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
151- && make clean \
145+ ${PHP_EXTRA_CONFIGURE_ARGS:-} \
146+ ; \
147+ make -j "$(nproc)" ; \
148+ find -type f -name '*.a' -delete; \
149+ make install; \
150+ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
151+ make clean; \
152152 \
153153# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
154- && cp -v php.ini-* "$PHP_INI_DIR/" \
154+ cp -v php.ini-* "$PHP_INI_DIR/" ; \
155155 \
156- && cd / \
157- && docker-php-source delete \
156+ cd /; \
157+ docker-php-source delete; \
158158 \
159- && runDeps="$( \
159+ runDeps="$( \
160160 scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
161161 | tr ',' '\n ' \
162162 | sort -u \
163163 | awk 'system(" [ -e /usr/local/lib/" $1 " ]") == 0 { next } { print " so:" $1 }' \
164- )" \
165- && apk add --no-cache $runDeps \
164+ )" ; \
165+ apk add --no-cache $runDeps; \
166166 \
167- && apk del --no-network .build-deps \
167+ apk del --no-network .build-deps; \
168168 \
169169# update pecl channel definitions https://github.com/docker-library/php/issues/443
170- && pecl update-channels \
171- && rm -rf /tmp/pear ~/.pearrc \
170+ pecl update-channels; \
171+ rm -rf /tmp/pear ~/.pearrc; \
172172# smoke test
173- && php --version
173+ php --version
174174
175175COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
176176
177177ENTRYPOINT ["docker-php-entrypoint" ]
178178# #<autogenerated>##
179179WORKDIR /var/www/html
180180
181- RUN set -ex \
182- && cd /usr/local/etc \
183- && if [ -d php-fpm.d ]; then \
181+ RUN set -eux; \
182+ cd /usr/local/etc; \
183+ if [ -d php-fpm.d ]; then \
184184 # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
185185 sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
186186 cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
@@ -192,8 +192,8 @@ RUN set -ex \
192192 echo '[global]' ; \
193193 echo 'include=etc/php-fpm.d/*.conf' ; \
194194 } | tee php-fpm.conf; \
195- fi \
196- && { \
195+ fi; \
196+ { \
197197 echo '[global]' ; \
198198 echo 'error_log = /proc/self/fd/2' ; \
199199 echo; \
@@ -205,8 +205,8 @@ RUN set -ex \
205205 echo; \
206206 echo '; Ensure worker stdout and stderr are sent to the main error log.' ; \
207207 echo 'catch_workers_output = yes' ; \
208- } | tee php-fpm.d/docker.conf \
209- && { \
208+ } | tee php-fpm.d/docker.conf; \
209+ { \
210210 echo '[global]' ; \
211211 echo 'daemonize = no' ; \
212212 echo; \
0 commit comments