1
- ARG PG_SERVER_VERSION=11
1
+ ARG PG_SERVER_VERSION=12
2
2
3
3
FROM postgres:${PG_SERVER_VERSION}
4
4
LABEL maintainer="postgres.ai"
5
5
6
-
7
6
ARG PG_SERVER_VERSION
8
7
ENV PG_SERVER_VERSION=${PG_SERVER_VERSION:-12}
8
+
9
9
ENV CITUS_VERSION=9.4
10
10
11
11
RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
@@ -20,25 +20,24 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
20
20
&& apt-get install --no-install-recommends -y \
21
21
postgresql-${PG_SERVER_VERSION}-hypopg \
22
22
&& apt-get install --no-install-recommends -y \
23
- postgresql-${PG_SERVER_VERSION}-hypopg-dbgsym \
24
- # pg_hint_plan extension (convert versions with dot "9.6" to "96")
23
+ postgresql-${PG_SERVER_VERSION}-hypopg-dbgsym \
24
+ # pg_hint_plan extension (dots are to be skipped here, e.g., "9.6" -> "96")
25
25
&& export PG_PLAN_HINT_VERSION=$(echo $PG_SERVER_VERSION | sed 's/\. //' ) \
26
26
&& wget --quiet -O /tmp/pg_hint_plan.zip \
27
27
https://github.com/ossc-db/pg_hint_plan/archive/PG${PG_PLAN_HINT_VERSION}.zip \
28
28
&& unzip /tmp/pg_hint_plan.zip -d /tmp \
29
29
&& cd /tmp/pg_hint_plan-PG${PG_PLAN_HINT_VERSION} \
30
30
&& make && make install \
31
31
# timescaledb extension
32
- && echo 'deb https://packagecloud.io/timescale/timescaledb/debian/' \
33
- $(env -i bash -c '. /etc/os-release; echo ${VERSION_CODENAME}' ) \
32
+ && echo 'deb https://packagecloud.io/timescale/timescaledb/debian/' \
33
+ $(env -i bash -c '. /etc/os-release; echo ${VERSION_CODENAME}' ) \
34
34
'main' > /etc/apt/sources.list.d/timescaledb.list \
35
35
&& wget --quiet -O - \
36
36
https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - \
37
37
&& apt-get update \
38
38
&& apt-get install -y timescaledb-postgresql-${PG_SERVER_VERSION} \
39
- # citus extension. 11 and 12 versions only are supported by citus
39
+ # citus extension; only Postgres 11 and 12 are supported by citus
40
40
&& if [ "${PG_SERVER_VERSION}" = "12" ] || [ "${PG_SERVER_VERSION}" = "11" ]; then \
41
- # only 11 and 12 versions are supported by citus
42
41
curl -s https://install.citusdata.com/community/deb.sh | bash \
43
42
&& apt-get install -y postgresql-${PG_SERVER_VERSION}-citus-${CITUS_VERSION} \
44
43
postgresql-${PG_SERVER_VERSION}-hll=2.14.citus-1 \
@@ -56,21 +55,21 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
56
55
&& export USE_PGXS=1 && make && make install && cd .. && rm -rf pg_show_plans \
57
56
# pg_cron extension
58
57
&& apt-get install -y postgresql-${PG_SERVER_VERSION}-cron \
59
- # postgresql_anonymizer extension
58
+ # postgresql_anonymizer extension
60
59
&& pgxn install ddlx && pgxn install postgresql_anonymizer \
61
60
# pg_stat_kcache extension
62
61
&& apt-get install postgresql-${PG_SERVER_VERSION}-pg-stat-kcache \
63
62
# add pg_qualstats extension
64
63
&& apt-get install postgresql-${PG_SERVER_VERSION}-pg-qualstats \
65
64
# pg_mon extension
66
- && git clone https://github.com/CyberDem0n/bg_mon.git && cd bg_mon \
65
+ && git clone https://github.com/CyberDem0n/bg_mon.git && cd bg_mon \
67
66
&& USE_PGXS=1 make && USE_PGXS=1 make install \
68
67
# pgextwlist extension
69
68
&& apt-get install postgresql-${PG_SERVER_VERSION}-pgextwlist \
70
69
# pg_auth_mon extension
71
70
&& git clone https://github.com/RafiaSabih/pg_auth_mon.git \
72
71
&& cd pg_auth_mon && USE_PGXS=1 make && USE_PGXS=1 make install \
73
- # set_user extension
72
+ # set_user extension
74
73
&& git clone https://github.com/pgaudit/set_user.git \
75
74
&& cd set_user && make USE_PGXS=1 && make USE_PGXS=1 install \
76
75
# remove all auxilary packages to reduce final image size
@@ -81,18 +80,18 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
81
80
libgssrpc4 libkadm5clnt-mit11 libkadm5srv-mit11 \
82
81
&& apt-get clean -y autoclean \
83
82
&& rm -rf /var/lib/apt/lists/* \
84
- # remove standard pgdata
85
- && rm -rf /var/lib/postgresql/${PG_SERVER_VERSION}/
83
+ # remove standard pgdata
84
+ && rm -rf /var/lib/postgresql/${PG_SERVER_VERSION}/
86
85
87
86
EXPOSE 5432
88
87
89
- # Prepare Postgres start script.
88
+ # Prepare Postgres start script
90
89
RUN echo "#!/bin/bash" > /pg_start.sh && chmod a+x /pg_start.sh \
91
90
&& echo "chown -R postgres:postgres /var/lib/postgresql/pgdata /var/run/postgresql" \
92
91
>> /pg_start.sh \
93
92
&& printf "sudo -u postgres /usr/lib/postgresql/${PG_SERVER_VERSION}/bin/postgres -D /var/lib/postgresql/pgdata \n " \
94
93
>> /pg_start.sh \
95
- # Infinite sleep to allow restarting Postgres.
94
+ # Infinite sleep to allow restarting Postgres
96
95
&& echo "/bin/bash -c \" trap : TERM INT; sleep infinity & wait\" " \
97
96
>> /pg_start.sh
98
97
0 commit comments