@@ -21,19 +21,20 @@ ENV PG_MAJOR 10
2121ENV PG_VERSION 10.13
2222ENV 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")
131138RUN sed -ri "s!^#?(listen_addresses)\s *=\s *\S +.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
0 commit comments