@@ -21,19 +21,20 @@ ENV PG_MAJOR 10
21
21
ENV PG_VERSION 10.13
22
22
ENV PG_SHA256 4d701f450cd92ffb123cf6c296e9656abbc2ab7ea6507894ff1e2475ae0754e1
23
23
24
- RUN set -ex \
24
+ RUN set -eux; \
25
25
\
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 \
30
30
--extract \
31
31
--file postgresql.tar.bz2 \
32
32
--directory /usr/src/postgresql \
33
33
--strip-components 1 \
34
- && rm postgresql.tar.bz2 \
34
+ ; \
35
+ rm postgresql.tar.bz2; \
35
36
\
36
- && apk add --no-cache --virtual .build-deps \
37
+ apk add --no-cache --virtual .build-deps \
37
38
bison \
38
39
coreutils \
39
40
dpkg-dev dpkg \
@@ -59,20 +60,21 @@ RUN set -ex \
59
60
util-linux-dev \
60
61
zlib-dev \
61
62
icu-dev \
63
+ ; \
62
64
\
63
- && cd /usr/src/postgresql \
65
+ cd /usr/src/postgresql; \
64
66
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
65
67
# 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)" ; \
70
72
# 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' ; \
73
75
# configure options taken from:
74
76
# https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
75
- && ./configure \
77
+ ./configure \
76
78
--build="$gnuArch" \
77
79
# "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'"
78
80
# --enable-nls \
@@ -102,30 +104,35 @@ RUN set -ex \
102
104
--with-libxml \
103
105
--with-libxslt \
104
106
--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; \
108
111
\
109
- && runDeps="$( \
112
+ runDeps="$( \
110
113
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
111
114
| tr ',' '\n ' \
112
115
| sort -u \
113
116
| 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 \
116
119
$runDeps \
117
120
bash \
118
121
su-exec \
119
122
# tzdata is optional, but only adds around 1Mb to image size and is recommended by Django documentation:
120
123
# https://docs.djangoproject.com/en/1.10/ref/databases/#optimizing-postgresql-s-configuration
121
124
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 \
125
129
/usr/src/postgresql \
126
130
/usr/local/share/doc \
127
131
/usr/local/share/man \
128
- && find /usr/local -name '*.a' -delete
132
+ ; \
133
+ find /usr/local -name '*.a' -delete; \
134
+ \
135
+ postgres --version
129
136
130
137
# make the sample config easier to munge (and "correct by default")
131
138
RUN sed -ri "s!^#?(listen_addresses)\s *=\s *\S +.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
0 commit comments