Skip to content

Commit 52a9614

Browse files
Add "set -u" and more consistency
1 parent ea272f9 commit 52a9614

File tree

43 files changed

+341
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+341
-459
lines changed

7.1/alpine3.10/cli/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -65,11 +65,9 @@ ENV PHP_VERSION 7.1.30
6565
ENV 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"
6666
ENV PHP_SHA256="6310599811536dbe87e4bcf212bf93196bdfaff519d0c821e4c0068efd096a7c" PHP_MD5=""
6767

68-
RUN set -xe; \
68+
RUN set -eux; \
6969
\
70-
apk add --no-cache --virtual .fetch-deps \
71-
gnupg \
72-
; \
70+
apk add --no-cache --virtual .fetch-deps gnupg; \
7371
\
7472
mkdir -p /usr/src; \
7573
cd /usr/src; \
@@ -90,15 +88,15 @@ RUN set -xe; \
9088
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9189
done; \
9290
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
93-
command -v gpgconf > /dev/null && gpgconf --kill all; \
91+
gpgconf --kill all; \
9492
rm -rf "$GNUPGHOME"; \
9593
fi; \
9694
\
9795
apk del --no-network .fetch-deps
9896

9997
COPY docker-php-source /usr/local/bin/
10098

101-
RUN set -xe; \
99+
RUN set -eux; \
102100
apk add --no-cache --virtual .build-deps \
103101
$PHPIZE_DEPS \
104102
coreutils \
@@ -143,12 +141,12 @@ RUN set -xe; \
143141
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
144142
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
145143
\
146-
$PHP_EXTRA_CONFIGURE_ARGS \
144+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
147145
; \
148146
make -j "$(nproc)"; \
149147
find -type f -name '*.a' -delete; \
150148
make install; \
151-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
149+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
152150
make clean; \
153151
\
154152
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)

7.1/alpine3.10/fpm/Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -66,11 +66,9 @@ ENV PHP_VERSION 7.1.30
6666
ENV 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"
6767
ENV 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-
; \
71+
apk add --no-cache --virtual .fetch-deps gnupg; \
7472
\
7573
mkdir -p /usr/src; \
7674
cd /usr/src; \
@@ -91,15 +89,15 @@ RUN set -xe; \
9189
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9290
done; \
9391
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
94-
command -v gpgconf > /dev/null && gpgconf --kill all; \
92+
gpgconf --kill all; \
9593
rm -rf "$GNUPGHOME"; \
9694
fi; \
9795
\
9896
apk del --no-network .fetch-deps
9997

10098
COPY docker-php-source /usr/local/bin/
10199

102-
RUN set -xe; \
100+
RUN set -eux; \
103101
apk add --no-cache --virtual .build-deps \
104102
$PHPIZE_DEPS \
105103
coreutils \
@@ -144,12 +142,12 @@ RUN set -xe; \
144142
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
145143
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
146144
\
147-
$PHP_EXTRA_CONFIGURE_ARGS \
145+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
148146
; \
149147
make -j "$(nproc)"; \
150148
find -type f -name '*.a' -delete; \
151149
make install; \
152-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
150+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
153151
make clean; \
154152
\
155153
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
@@ -180,7 +178,7 @@ ENTRYPOINT ["docker-php-entrypoint"]
180178
##<autogenerated>##
181179
WORKDIR /var/www/html
182180

183-
RUN set -ex; \
181+
RUN set -eux; \
184182
cd /usr/local/etc; \
185183
if [ -d php-fpm.d ]; then \
186184
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"

7.1/alpine3.10/zts/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -66,11 +66,9 @@ ENV PHP_VERSION 7.1.30
6666
ENV 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"
6767
ENV 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-
; \
71+
apk add --no-cache --virtual .fetch-deps gnupg; \
7472
\
7573
mkdir -p /usr/src; \
7674
cd /usr/src; \
@@ -91,15 +89,15 @@ RUN set -xe; \
9189
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9290
done; \
9391
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
94-
command -v gpgconf > /dev/null && gpgconf --kill all; \
92+
gpgconf --kill all; \
9593
rm -rf "$GNUPGHOME"; \
9694
fi; \
9795
\
9896
apk del --no-network .fetch-deps
9997

10098
COPY docker-php-source /usr/local/bin/
10199

102-
RUN set -xe; \
100+
RUN set -eux; \
103101
apk add --no-cache --virtual .build-deps \
104102
$PHPIZE_DEPS \
105103
coreutils \
@@ -144,12 +142,12 @@ RUN set -xe; \
144142
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
145143
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
146144
\
147-
$PHP_EXTRA_CONFIGURE_ARGS \
145+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
148146
; \
149147
make -j "$(nproc)"; \
150148
find -type f -name '*.a' -delete; \
151149
make install; \
152-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
150+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
153151
make clean; \
154152
\
155153
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)

7.1/alpine3.9/cli/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -65,11 +65,9 @@ ENV PHP_VERSION 7.1.30
6565
ENV 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"
6666
ENV PHP_SHA256="6310599811536dbe87e4bcf212bf93196bdfaff519d0c821e4c0068efd096a7c" PHP_MD5=""
6767

68-
RUN set -xe; \
68+
RUN set -eux; \
6969
\
70-
apk add --no-cache --virtual .fetch-deps \
71-
gnupg \
72-
; \
70+
apk add --no-cache --virtual .fetch-deps gnupg; \
7371
\
7472
mkdir -p /usr/src; \
7573
cd /usr/src; \
@@ -90,15 +88,15 @@ RUN set -xe; \
9088
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9189
done; \
9290
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
93-
command -v gpgconf > /dev/null && gpgconf --kill all; \
91+
gpgconf --kill all; \
9492
rm -rf "$GNUPGHOME"; \
9593
fi; \
9694
\
9795
apk del --no-network .fetch-deps
9896

9997
COPY docker-php-source /usr/local/bin/
10098

101-
RUN set -xe; \
99+
RUN set -eux; \
102100
apk add --no-cache --virtual .build-deps \
103101
$PHPIZE_DEPS \
104102
coreutils \
@@ -143,12 +141,12 @@ RUN set -xe; \
143141
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
144142
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
145143
\
146-
$PHP_EXTRA_CONFIGURE_ARGS \
144+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
147145
; \
148146
make -j "$(nproc)"; \
149147
find -type f -name '*.a' -delete; \
150148
make install; \
151-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
149+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
152150
make clean; \
153151
\
154152
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)

7.1/alpine3.9/fpm/Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -66,11 +66,9 @@ ENV PHP_VERSION 7.1.30
6666
ENV 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"
6767
ENV 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-
; \
71+
apk add --no-cache --virtual .fetch-deps gnupg; \
7472
\
7573
mkdir -p /usr/src; \
7674
cd /usr/src; \
@@ -91,15 +89,15 @@ RUN set -xe; \
9189
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9290
done; \
9391
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
94-
command -v gpgconf > /dev/null && gpgconf --kill all; \
92+
gpgconf --kill all; \
9593
rm -rf "$GNUPGHOME"; \
9694
fi; \
9795
\
9896
apk del --no-network .fetch-deps
9997

10098
COPY docker-php-source /usr/local/bin/
10199

102-
RUN set -xe; \
100+
RUN set -eux; \
103101
apk add --no-cache --virtual .build-deps \
104102
$PHPIZE_DEPS \
105103
coreutils \
@@ -144,12 +142,12 @@ RUN set -xe; \
144142
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
145143
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
146144
\
147-
$PHP_EXTRA_CONFIGURE_ARGS \
145+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
148146
; \
149147
make -j "$(nproc)"; \
150148
find -type f -name '*.a' -delete; \
151149
make install; \
152-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
150+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
153151
make clean; \
154152
\
155153
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
@@ -180,7 +178,7 @@ ENTRYPOINT ["docker-php-entrypoint"]
180178
##<autogenerated>##
181179
WORKDIR /var/www/html
182180

183-
RUN set -ex; \
181+
RUN set -eux; \
184182
cd /usr/local/etc; \
185183
if [ -d php-fpm.d ]; then \
186184
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"

7.1/alpine3.9/zts/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apk add --no-cache \
2929
openssl
3030

3131
# ensure www-data user exists
32-
RUN set -xe; \
32+
RUN set -eux; \
3333
addgroup -g 82 -S www-data; \
3434
adduser -u 82 -D -S -G www-data www-data
3535
# 82 is the standard uid/gid for "www-data" in Alpine
@@ -66,11 +66,9 @@ ENV PHP_VERSION 7.1.30
6666
ENV 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"
6767
ENV 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-
; \
71+
apk add --no-cache --virtual .fetch-deps gnupg; \
7472
\
7573
mkdir -p /usr/src; \
7674
cd /usr/src; \
@@ -91,15 +89,15 @@ RUN set -xe; \
9189
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9290
done; \
9391
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
94-
command -v gpgconf > /dev/null && gpgconf --kill all; \
92+
gpgconf --kill all; \
9593
rm -rf "$GNUPGHOME"; \
9694
fi; \
9795
\
9896
apk del --no-network .fetch-deps
9997

10098
COPY docker-php-source /usr/local/bin/
10199

102-
RUN set -xe; \
100+
RUN set -eux; \
103101
apk add --no-cache --virtual .build-deps \
104102
$PHPIZE_DEPS \
105103
coreutils \
@@ -144,12 +142,12 @@ RUN set -xe; \
144142
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
145143
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
146144
\
147-
$PHP_EXTRA_CONFIGURE_ARGS \
145+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
148146
; \
149147
make -j "$(nproc)"; \
150148
find -type f -name '*.a' -delete; \
151149
make install; \
152-
{ find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; }; \
150+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
153151
make clean; \
154152
\
155153
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)

7.1/stretch/apache/Dockerfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,12 @@ ENV PHP_VERSION 7.1.30
127127
ENV 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"
128128
ENV PHP_SHA256="6310599811536dbe87e4bcf212bf93196bdfaff519d0c821e4c0068efd096a7c" PHP_MD5=""
129129

130-
RUN set -xe; \
130+
RUN set -eux; \
131131
\
132-
if ! command -v gpg > /dev/null; then \
133-
fetchDeps=" \
134-
dirmngr \
135-
gnupg \
136-
"; \
137-
\
138-
apt-get update; \
139-
apt-get install -y --no-install-recommends $fetchDeps; \
140-
rm -rf /var/lib/apt/lists/*; \
141-
fi; \
132+
savedAptMark="$(apt-mark showmanual)"; \
133+
apt-get update; \
134+
apt-get install -y --no-install-recommends gnupg dirmngr; \
135+
rm -rf /var/lib/apt/lists/*; \
142136
\
143137
mkdir -p /usr/src; \
144138
cd /usr/src; \
@@ -159,11 +153,13 @@ RUN set -xe; \
159153
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
160154
done; \
161155
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
162-
command -v gpgconf > /dev/null && gpgconf --kill all; \
156+
gpgconf --kill all; \
163157
rm -rf "$GNUPGHOME"; \
164158
fi; \
165159
\
166-
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps
160+
apt-mark auto '.*' > /dev/null; \
161+
apt-mark manual $savedAptMark > /dev/null; \
162+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
167163

168164
COPY docker-php-source /usr/local/bin/
169165

0 commit comments

Comments
 (0)