From 1bddd083582b0977075dda4258f2d9dfbc90482b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 25 Jun 2020 11:30:52 -0700 Subject: [PATCH] Replace "&&" chains with ";" in Alpine variants --- 10/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- 11/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- 12/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- 13/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- 9.5/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- 9.6/alpine/Dockerfile | 57 +++++++++++++++++++++----------------- Dockerfile-alpine.template | 57 +++++++++++++++++++++----------------- 7 files changed, 224 insertions(+), 175 deletions(-) diff --git a/10/alpine/Dockerfile b/10/alpine/Dockerfile index 05ffa637c3..c69a359c6a 100644 --- a/10/alpine/Dockerfile +++ b/10/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 10 ENV PG_VERSION 10.13 ENV PG_SHA256 4d701f450cd92ffb123cf6c296e9656abbc2ab7ea6507894ff1e2475ae0754e1 -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -59,20 +60,21 @@ RUN set -ex \ util-linux-dev \ zlib-dev \ icu-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -102,30 +104,35 @@ RUN set -ex \ --with-libxml \ --with-libxslt \ --with-icu \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/11/alpine/Dockerfile b/11/alpine/Dockerfile index 0bd32e2a11..ed221b86d0 100644 --- a/11/alpine/Dockerfile +++ b/11/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 11 ENV PG_VERSION 11.8 ENV PG_SHA256 eaf2f4329ccc349c89e950761b81daf8c99bb8966abcab5665ccd6ee95c77ae2 -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -60,20 +61,21 @@ RUN set -ex \ util-linux-dev \ zlib-dev \ icu-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -104,30 +106,35 @@ RUN set -ex \ --with-libxslt \ --with-icu \ --with-llvm \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/12/alpine/Dockerfile b/12/alpine/Dockerfile index 0fa15a9125..fc87027d02 100644 --- a/12/alpine/Dockerfile +++ b/12/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 12 ENV PG_VERSION 12.3 ENV PG_SHA256 94ed64a6179048190695c86ec707cc25d016056ce10fc9d229267d9a8f1dcf41 -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -60,20 +61,21 @@ RUN set -ex \ util-linux-dev \ zlib-dev \ icu-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -104,30 +106,35 @@ RUN set -ex \ --with-libxslt \ --with-icu \ --with-llvm \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/13/alpine/Dockerfile b/13/alpine/Dockerfile index cdf550d2ea..b1dd58a751 100644 --- a/13/alpine/Dockerfile +++ b/13/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 13 ENV PG_VERSION 13beta2 ENV PG_SHA256 51b8c64f4c354728555144a7bfbdced96afb86e5cfa80a26b5e96a1d9081ee9f -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -60,20 +61,21 @@ RUN set -ex \ util-linux-dev \ zlib-dev \ icu-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -104,30 +106,35 @@ RUN set -ex \ --with-libxslt \ --with-icu \ --with-llvm \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/9.5/alpine/Dockerfile b/9.5/alpine/Dockerfile index 324db32870..bdf5e1ab56 100644 --- a/9.5/alpine/Dockerfile +++ b/9.5/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 9.5 ENV PG_VERSION 9.5.22 ENV PG_SHA256 48555470a17248cb204d25ab1ad4231ef16295db55161922f006b9942d69640f -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -58,20 +59,21 @@ RUN set -ex \ # tcl-dev \ util-linux-dev \ zlib-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -100,30 +102,35 @@ RUN set -ex \ --with-openssl \ --with-libxml \ --with-libxslt \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/9.6/alpine/Dockerfile b/9.6/alpine/Dockerfile index 814f145b43..231a978624 100644 --- a/9.6/alpine/Dockerfile +++ b/9.6/alpine/Dockerfile @@ -21,19 +21,20 @@ ENV PG_MAJOR 9.6 ENV PG_VERSION 9.6.18 ENV PG_SHA256 517ec282b785e6d22f360c30ba0c5e2a506fca5ca07dcc545427511d94c89999 -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -58,20 +59,21 @@ RUN set -ex \ # tcl-dev \ util-linux-dev \ zlib-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -100,30 +102,35 @@ RUN set -ex \ --with-openssl \ --with-libxml \ --with-libxslt \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index c0ffab0e6c..0fe9e40ba5 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -21,19 +21,20 @@ ENV PG_MAJOR %%PG_MAJOR%% ENV PG_VERSION %%PG_VERSION%% ENV PG_SHA256 %%PG_SHA256%% -RUN set -ex \ +RUN set -eux; \ \ - && wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" \ - && echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c - \ - && mkdir -p /usr/src/postgresql \ - && tar \ + wget -O postgresql.tar.bz2 "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2"; \ + echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -; \ + mkdir -p /usr/src/postgresql; \ + tar \ --extract \ --file postgresql.tar.bz2 \ --directory /usr/src/postgresql \ --strip-components 1 \ - && rm postgresql.tar.bz2 \ + ; \ + rm postgresql.tar.bz2; \ \ - && apk add --no-cache --virtual .build-deps \ + apk add --no-cache --virtual .build-deps \ bison \ coreutils \ dpkg-dev dpkg \ @@ -60,20 +61,21 @@ RUN set -ex \ util-linux-dev \ zlib-dev \ icu-dev \ + ; \ \ - && cd /usr/src/postgresql \ + cd /usr/src/postgresql; \ # update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian) # see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f - && 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 \ - && grep '/var/run/postgresql' src/include/pg_config_manual.h.new \ - && mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + 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; \ + grep '/var/run/postgresql' src/include/pg_config_manual.h.new; \ + mv src/include/pg_config_manual.h.new src/include/pg_config_manual.h; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ # explicitly update autoconf config.guess and config.sub so they support more arches/libcs - && wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb' \ - && wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb' \ + wget -O config/config.guess 'https://git.savannah.gnu.org/cgit/config.git/plain/config.guess?id=7d3d27baf8107b630586c962c057e22149653deb'; \ + wget -O config/config.sub 'https://git.savannah.gnu.org/cgit/config.git/plain/config.sub?id=7d3d27baf8107b630586c962c057e22149653deb'; \ # configure options taken from: # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5 - && ./configure \ + ./configure \ --build="$gnuArch" \ # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'" # --enable-nls \ @@ -104,30 +106,35 @@ RUN set -ex \ --with-libxslt \ --with-icu \ --with-llvm \ - && make -j "$(nproc)" world \ - && make install-world \ - && make -C contrib install \ + ; \ + make -j "$(nproc)" world; \ + make install-world; \ + make -C contrib install; \ \ - && runDeps="$( \ + runDeps="$( \ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )" \ - && apk add --no-cache --virtual .postgresql-rundeps \ + )"; \ + apk add --no-cache --virtual .postgresql-rundeps \ $runDeps \ bash \ su-exec \ # tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation: # https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration tzdata \ - && apk del --no-network .build-deps \ - && cd / \ - && rm -rf \ + ; \ + apk del --no-network .build-deps; \ + cd /; \ + rm -rf \ /usr/src/postgresql \ /usr/local/share/doc \ /usr/local/share/man \ - && find /usr/local -name '*.a' -delete + ; \ + find /usr/local -name '*.a' -delete; \ + \ + postgres --version # make the sample config easier to munge (and "correct by default") RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample