Skip to content

Commit 2e2df06

Browse files
authored
Merge pull request #843 from J0WI/curl
Use already available curl and consistent code style
2 parents c0f68b2 + 250c2d8 commit 2e2df06

File tree

43 files changed

+1167
-1218
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

+1167
-1218
lines changed

7.1/alpine3.10/cli/Dockerfile

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -65,17 +65,14 @@ 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-
wget \
73-
; \
70+
apk add --no-cache --virtual .fetch-deps gnupg; \
7471
\
7572
mkdir -p /usr/src; \
7673
cd /usr/src; \
7774
\
78-
wget -O php.tar.xz "$PHP_URL"; \
75+
curl -fsSL -o php.tar.xz "$PHP_URL"; \
7976
\
8077
if [ -n "$PHP_SHA256" ]; then \
8178
echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \
@@ -85,37 +82,39 @@ RUN set -xe; \
8582
fi; \
8683
\
8784
if [ -n "$PHP_ASC_URL" ]; then \
88-
wget -O php.tar.xz.asc "$PHP_ASC_URL"; \
85+
curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \
8986
export GNUPGHOME="$(mktemp -d)"; \
9087
for key in $GPG_KEYS; do \
9188
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
9289
done; \
9390
gpg --batch --verify php.tar.xz.asc php.tar.xz; \
94-
command -v gpgconf > /dev/null && gpgconf --kill all; \
91+
gpgconf --kill all; \
9592
rm -rf "$GNUPGHOME"; \
9693
fi; \
9794
\
9895
apk del --no-network .fetch-deps
9996

10097
COPY docker-php-source /usr/local/bin/
10198

102-
RUN set -xe \
103-
&& apk add --no-cache --virtual .build-deps \
99+
RUN set -eux; \
100+
apk add --no-cache --virtual .build-deps \
104101
$PHPIZE_DEPS \
105102
coreutils \
106103
curl-dev \
107104
libedit-dev \
108105
libxml2-dev \
109106
openssl-dev \
110107
sqlite-dev \
108+
; \
111109
\
112-
&& export CFLAGS="$PHP_CFLAGS" \
110+
export CFLAGS="$PHP_CFLAGS" \
113111
CPPFLAGS="$PHP_CPPFLAGS" \
114112
LDFLAGS="$PHP_LDFLAGS" \
115-
&& docker-php-source extract \
116-
&& cd /usr/src/php \
117-
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
118-
&& ./configure \
113+
; \
114+
docker-php-source extract; \
115+
cd /usr/src/php; \
116+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
117+
./configure \
119118
--build="$gnuArch" \
120119
--with-config-file-path="$PHP_INI_DIR" \
121120
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
@@ -142,34 +141,35 @@ RUN set -xe \
142141
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
143142
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
144143
\
145-
$PHP_EXTRA_CONFIGURE_ARGS \
146-
&& make -j "$(nproc)" \
147-
&& find -type f -name '*.a' -delete \
148-
&& make install \
149-
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
150-
&& make clean \
144+
${PHP_EXTRA_CONFIGURE_ARGS:-} \
145+
; \
146+
make -j "$(nproc)"; \
147+
find -type f -name '*.a' -delete; \
148+
make install; \
149+
find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; \
150+
make clean; \
151151
\
152152
# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable)
153-
&& cp -v php.ini-* "$PHP_INI_DIR/" \
153+
cp -v php.ini-* "$PHP_INI_DIR/"; \
154154
\
155-
&& cd / \
156-
&& docker-php-source delete \
155+
cd /; \
156+
docker-php-source delete; \
157157
\
158-
&& runDeps="$( \
158+
runDeps="$( \
159159
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
160160
| tr ',' '\n' \
161161
| sort -u \
162162
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
163-
)" \
164-
&& apk add --no-cache $runDeps \
163+
)"; \
164+
apk add --no-cache $runDeps; \
165165
\
166-
&& apk del --no-network .build-deps \
166+
apk del --no-network .build-deps; \
167167
\
168168
# update pecl channel definitions https://github.com/docker-library/php/issues/443
169-
&& pecl update-channels \
170-
&& rm -rf /tmp/pear ~/.pearrc \
169+
pecl update-channels; \
170+
rm -rf /tmp/pear ~/.pearrc; \
171171
# smoke test
172-
&& php --version
172+
php --version
173173

174174
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
175175

7.1/alpine3.10/fpm/Dockerfile

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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
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-
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

10198
COPY 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

175175
COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/
176176

177177
ENTRYPOINT ["docker-php-entrypoint"]
178178
##<autogenerated>##
179179
WORKDIR /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

Comments
 (0)