Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit aa3a243

Browse files
authored
Merge pull request docker-library#750 from infosiftr/ampersand
Replace "&&" chains with ";" in Alpine variants
2 parents bb0d979 + 1bddd08 commit aa3a243

File tree

7 files changed

+224
-175
lines changed

7 files changed

+224
-175
lines changed

10/alpine/Dockerfile

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ ENV PG_MAJOR 10
2121
ENV PG_VERSION 10.13
2222
ENV PG_SHA256 4d701f450cd92ffb123cf6c296e9656abbc2ab7ea6507894ff1e2475ae0754e1
2323

24-
RUN set -ex \
24+
RUN set -eux; \
2525
\
26-
&& wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \
27-
&& echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \
28-
&& mkdir -p /usr/src/postgresql \
29-
&& tar \
26+
wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \
27+
echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \
28+
mkdir -p /usr/src/postgresql; \
29+
tar \
3030
--extract \
3131
--file postgresql.tar.bz2 \
3232
--directory /usr/src/postgresql \
3333
--strip-components 1 \
34-
&& rm postgresql.tar.bz2 \
34+
; \
35+
rm postgresql.tar.bz2; \
3536
\
36-
&& apk add --no-cache --virtual .build-deps \
37+
apk add --no-cache --virtual .build-deps \
3738
bison \
3839
coreutils \
3940
dpkg-dev dpkg \
@@ -59,20 +60,21 @@ RUN set -ex \
5960
util-linux-dev \
6061
zlib-dev \
6162
icu-dev \
63+
; \
6264
\
63-
&& cd /usr/src/postgresql \
65+
cd /usr/src/postgresql; \
6466
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
6567
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
66-
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
67-
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
68-
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
69-
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
68+
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new; \
69+
grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \
70+
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \
71+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
7072
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
71-
&& wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \
72-
&& wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \
73+
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \
74+
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \
7375
# configure options taken from:
7476
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
75-
&& ./configure \
77+
./configure \
7678
--build="$gnuArch" \
7779
# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'"
7880
# --enable-nls \
@@ -102,30 +104,35 @@ RUN set -ex \
102104
--with-libxml \
103105
--with-libxslt \
104106
--with-icu \
105-
&& make -j "$(nproc)" world \
106-
&& make install-world \
107-
&& make -C contrib install \
107+
; \
108+
make -j "$(nproc)" world; \
109+
make install-world; \
110+
make -C contrib install; \
108111
\
109-
&& runDeps="$( \
112+
runDeps="$( \
110113
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
111114
| tr ',' '\n' \
112115
| sort -u \
113116
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
114-
)" \
115-
&& apk add --no-cache --virtual .postgresql-rundeps \
117+
)"; \
118+
apk add --no-cache --virtual .postgresql-rundeps \
116119
$runDeps \
117120
bash \
118121
su-exec \
119122
# tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation:
120123
# https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration
121124
tzdata \
122-
&& apk del --no-network .build-deps \
123-
&& cd / \
124-
&& rm -rf \
125+
; \
126+
apk del --no-network .build-deps; \
127+
cd /; \
128+
rm -rf \
125129
/usr/src/postgresql \
126130
/usr/local/share/doc \
127131
/usr/local/share/man \
128-
&& find /usr/local -name '*.a' -delete
132+
; \
133+
find /usr/local -name '*.a' -delete; \
134+
\
135+
postgres --version
129136

130137
# make the sample config easier to munge (and "correct by default")
131138
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample

11/alpine/Dockerfile

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ ENV PG_MAJOR 11
2121
ENV PG_VERSION 11.8
2222
ENV PG_SHA256 eaf2f4329ccc349c89e950761b81daf8c99bb8966abcab5665ccd6ee95c77ae2
2323

24-
RUN set -ex \
24+
RUN set -eux; \
2525
\
26-
&& wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \
27-
&& echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \
28-
&& mkdir -p /usr/src/postgresql \
29-
&& tar \
26+
wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \
27+
echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \
28+
mkdir -p /usr/src/postgresql; \
29+
tar \
3030
--extract \
3131
--file postgresql.tar.bz2 \
3232
--directory /usr/src/postgresql \
3333
--strip-components 1 \
34-
&& rm postgresql.tar.bz2 \
34+
; \
35+
rm postgresql.tar.bz2; \
3536
\
36-
&& apk add --no-cache --virtual .build-deps \
37+
apk add --no-cache --virtual .build-deps \
3738
bison \
3839
coreutils \
3940
dpkg-dev dpkg \
@@ -60,20 +61,21 @@ RUN set -ex \
6061
util-linux-dev \
6162
zlib-dev \
6263
icu-dev \
64+
; \
6365
\
64-
&& cd /usr/src/postgresql \
66+
cd /usr/src/postgresql; \
6567
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
6668
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
67-
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
68-
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
69-
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
70-
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
69+
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new; \
70+
grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \
71+
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \
72+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
7173
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
72-
&& wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \
73-
&& wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \
74+
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \
75+
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \
7476
# configure options taken from:
7577
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
76-
&& ./configure \
78+
./configure \
7779
--build="$gnuArch" \
7880
# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'"
7981
# --enable-nls \
@@ -104,30 +106,35 @@ RUN set -ex \
104106
--with-libxslt \
105107
--with-icu \
106108
--with-llvm \
107-
&& make -j "$(nproc)" world \
108-
&& make install-world \
109-
&& make -C contrib install \
109+
; \
110+
make -j "$(nproc)" world; \
111+
make install-world; \
112+
make -C contrib install; \
110113
\
111-
&& runDeps="$( \
114+
runDeps="$( \
112115
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
113116
| tr ',' '\n' \
114117
| sort -u \
115118
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
116-
)" \
117-
&& apk add --no-cache --virtual .postgresql-rundeps \
119+
)"; \
120+
apk add --no-cache --virtual .postgresql-rundeps \
118121
$runDeps \
119122
bash \
120123
su-exec \
121124
# tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation:
122125
# https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration
123126
tzdata \
124-
&& apk del --no-network .build-deps \
125-
&& cd / \
126-
&& rm -rf \
127+
; \
128+
apk del --no-network .build-deps; \
129+
cd /; \
130+
rm -rf \
127131
/usr/src/postgresql \
128132
/usr/local/share/doc \
129133
/usr/local/share/man \
130-
&& find /usr/local -name '*.a' -delete
134+
; \
135+
find /usr/local -name '*.a' -delete; \
136+
\
137+
postgres --version
131138

132139
# make the sample config easier to munge (and "correct by default")
133140
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample

12/alpine/Dockerfile

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@ ENV PG_MAJOR 12
2121
ENV PG_VERSION 12.3
2222
ENV PG_SHA256 94ed64a6179048190695c86ec707cc25d016056ce10fc9d229267d9a8f1dcf41
2323

24-
RUN set -ex \
24+
RUN set -eux; \
2525
\
26-
&& wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \
27-
&& echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \
28-
&& mkdir -p /usr/src/postgresql \
29-
&& tar \
26+
wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \
27+
echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \
28+
mkdir -p /usr/src/postgresql; \
29+
tar \
3030
--extract \
3131
--file postgresql.tar.bz2 \
3232
--directory /usr/src/postgresql \
3333
--strip-components 1 \
34-
&& rm postgresql.tar.bz2 \
34+
; \
35+
rm postgresql.tar.bz2; \
3536
\
36-
&& apk add --no-cache --virtual .build-deps \
37+
apk add --no-cache --virtual .build-deps \
3738
bison \
3839
coreutils \
3940
dpkg-dev dpkg \
@@ -60,20 +61,21 @@ RUN set -ex \
6061
util-linux-dev \
6162
zlib-dev \
6263
icu-dev \
64+
; \
6365
\
64-
&& cd /usr/src/postgresql \
66+
cd /usr/src/postgresql; \
6567
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
6668
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
67-
&& awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new \
68-
&& grep '/var/run/postgresql' src/include/pg_config_manual.h.new \
69-
&& mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \
70-
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
69+
awk '$1 == "#define" && $2 == "DEFAULT_PGSOCKET_DIR" && $3 == "\"/tmp\"" { $3 = "\"/var/run/postgresql\""; print; next } { print }' src/include/pg_config_manual.h > src/include/pg_config_manual.h.new; \
70+
grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \
71+
mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \
72+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
7173
# explicitly update autoconf config.guess and config.sub so they support more arches/libcs
72-
&& wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \
73-
&& wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \
74+
wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \
75+
wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \
7476
# configure options taken from:
7577
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
76-
&& ./configure \
78+
./configure \
7779
--build="$gnuArch" \
7880
# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'"
7981
# --enable-nls \
@@ -104,30 +106,35 @@ RUN set -ex \
104106
--with-libxslt \
105107
--with-icu \
106108
--with-llvm \
107-
&& make -j "$(nproc)" world \
108-
&& make install-world \
109-
&& make -C contrib install \
109+
; \
110+
make -j "$(nproc)" world; \
111+
make install-world; \
112+
make -C contrib install; \
110113
\
111-
&& runDeps="$( \
114+
runDeps="$( \
112115
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
113116
| tr ',' '\n' \
114117
| sort -u \
115118
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
116-
)" \
117-
&& apk add --no-cache --virtual .postgresql-rundeps \
119+
)"; \
120+
apk add --no-cache --virtual .postgresql-rundeps \
118121
$runDeps \
119122
bash \
120123
su-exec \
121124
# tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation:
122125
# https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration
123126
tzdata \
124-
&& apk del --no-network .build-deps \
125-
&& cd / \
126-
&& rm -rf \
127+
; \
128+
apk del --no-network .build-deps; \
129+
cd /; \
130+
rm -rf \
127131
/usr/src/postgresql \
128132
/usr/local/share/doc \
129133
/usr/local/share/man \
130-
&& find /usr/local -name '*.a' -delete
134+
; \
135+
find /usr/local -name '*.a' -delete; \
136+
\
137+
postgres --version
131138

132139
# make the sample config easier to munge (and "correct by default")
133140
RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample

0 commit comments

Comments
 (0)