2
2
# If you are using "physical" mode, please check the glibc version in your production database system to avoid potential index corruption.
3
3
# You should have the same version of glibc as in your Docker image.
4
4
5
- ARG PG_SERVER_VERSION=14
5
+ ARG PG_SERVER_VERSION=15
6
6
7
7
# build-env
8
8
FROM postgres:${PG_SERVER_VERSION}-bullseye as build-env
9
9
10
- ARG WALG_VERSION
11
- ENV WALG_VERSION=${WALG_VERSION:-2.0.0}
10
+ ARG TARGETPLATFORM
12
11
13
12
ARG GO_VERSION
14
- ENV GO_VERSION=${GO_VERSION:-1.18.4}
13
+ ENV GO_VERSION=${GO_VERSION:-1.20.3}
14
+
15
+ ARG WALG_VERSION
16
+ ENV WALG_VERSION=${WALG_VERSION:-2.0.1}
15
17
16
18
RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
17
19
# install dependencies
@@ -20,13 +22,15 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
20
22
wget curl sudo git make cmake gcc build-essential \
21
23
libbrotli-dev liblzo2-dev libsodium-dev \
22
24
# install Go
23
- && cd /tmp && wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz \
24
- && rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \
25
- && export PATH=$PATH:/usr/local/go/bin \
25
+ && cd /tmp && GO_ARCH=$(if [ -z "${TARGETPLATFORM}" ]; then echo "amd64" ; else echo ${TARGETPLATFORM} | cut -d '/' -f2; fi) \
26
+ && export PATH=$PATH:/usr/local/go/bin && wget https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz \
27
+ && rm -rf /usr/local/go && tar -C /usr/local -xzf go${GO_VERSION}.linux-${GO_ARCH}.tar.gz \
28
+ && export PATH=$PATH:/usr/local/go/bin \
26
29
# build WAL-G
27
- && git clone --branch v${WALG_VERSION} --single-branch https://github.com/wal-g/wal-g.git \
28
- && cd wal-g && export USE_LIBSODIUM=1 && export USE_LZO=1 \
29
- && make deps && GOBIN=/usr/local/bin make pg_install
30
+ && cd /tmp && git clone --branch v${WALG_VERSION} --single-branch https://github.com/wal-g/wal-g.git \
31
+ && cd wal-g && export USE_LIBSODIUM=1 && export USE_LZO=1 \
32
+ && make deps && GOBIN=/usr/local/bin make pg_install
33
+
30
34
31
35
# Build the extended image
32
36
FROM postgres:${PG_SERVER_VERSION}-bullseye
@@ -35,10 +39,16 @@ LABEL maintainer="postgres.ai"
35
39
COPY --from=build-env /usr/local/bin/wal-g /usr/local/bin/wal-g
36
40
37
41
ARG PG_SERVER_VERSION
38
- ENV PG_SERVER_VERSION=${PG_SERVER_VERSION:-14 }
42
+ ENV PG_SERVER_VERSION=${PG_SERVER_VERSION:-15 }
39
43
40
44
ARG PG_TIMETABLE_VERSION
41
- ENV PG_TIMETABLE_VERSION=${PG_TIMETABLE_VERSION:-4.9.0}
45
+ ENV PG_TIMETABLE_VERSION=${PG_TIMETABLE_VERSION:-5.3.0}
46
+ ARG SET_USER_VERSION
47
+ ENV SET_USER_VERSION=${SET_USER_VERSION:-REL4_0_1}
48
+ ARG LOGERRORS_VERSION
49
+ ENV LOGERRORS_VERSION=${LOGERRORS_VERSION:-2.1.2}
50
+ ARG PGVECTOR_VERSION
51
+ ENV PGVECTOR_VERSION=${PGVECTOR_VERSION:-0.4.1}
42
52
43
53
RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
44
54
# remove the "beta" and "rc" suffix in the PG_SERVER_VERSION variable (if exists)
@@ -47,54 +57,35 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
47
57
&& apt-get install --no-install-recommends -y wget make gcc unzip sudo git \
48
58
curl libc6-dev apt-transport-https ca-certificates pgxnclient bc \
49
59
build-essential libssl-dev krb5-multidev libkrb5-dev lsb-release apt-utils \
50
- && apt-get install --no-install-recommends -y \
51
- postgresql-server-dev-${PG_SERVER_VERSION} \
60
+ && apt-get install --no-install-recommends -y postgresql-server-dev-${PG_SERVER_VERSION} \
52
61
# plpython3 (procedural language implementation for Python 3.x)
53
- && apt-get install --no-install-recommends -y \
54
- postgresql-plpython3-${PG_SERVER_VERSION} \
62
+ && apt-get install --no-install-recommends -y postgresql-plpython3-${PG_SERVER_VERSION} \
55
63
# amcheck extension; not included in contrib for Postgres 9.6
56
64
&& if [ "${PG_SERVER_VERSION}" = "9.6" ]; then \
57
- apt-get install --no-install-recommends -y \
58
- postgresql-9.6-amcheck; \
65
+ apt-get install --no-install-recommends -y postgresql-9.6-amcheck; \
59
66
fi \
60
67
# pg_repack extension
61
- && if [ $(echo "$PG_SERVER_VERSION < 15" | /usr/bin/bc) = "1" ]; then \
62
- apt-get install --no-install-recommends -y \
63
- postgresql-${PG_SERVER_VERSION}-repack; \
64
- fi \
68
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-repack \
65
69
# hypopg extension
66
70
&& apt-get install --no-install-recommends -y \
67
- postgresql-${PG_SERVER_VERSION}-hypopg \
68
- postgresql-${PG_SERVER_VERSION}-hypopg-dbgsym \
71
+ postgresql-${PG_SERVER_VERSION}-hypopg \
72
+ postgresql-${PG_SERVER_VERSION}-hypopg-dbgsym \
69
73
# pgaudit extension
70
- && apt-get install --no-install-recommends -y \
71
- postgresql-${PG_SERVER_VERSION}-pgaudit \
74
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-pgaudit \
72
75
# pg_hint_plan extension
73
- && if [ $(echo "$PG_SERVER_VERSION < 14" | /usr/bin/bc) = "1" ]; then \
74
- export PG_PLAN_HINT_VERSION=$(echo $PG_SERVER_VERSION | sed 's/\. //' ) \
75
- && wget --quiet -O /tmp/pg_hint_plan.zip \
76
- https://github.com/ossc-db/pg_hint_plan/archive/PG${PG_PLAN_HINT_VERSION}.zip \
77
- && unzip /tmp/pg_hint_plan.zip -d /tmp \
78
- && cd /tmp/pg_hint_plan-PG${PG_PLAN_HINT_VERSION} \
79
- && make && make install; \
80
- # there is no branch "PG14", use the tag "REL14_1_4_0"
81
- elif [ "${PG_SERVER_VERSION}" = "14" ]; then \
82
- wget --quiet -O /tmp/pg_hint_plan.zip \
83
- https://github.com/ossc-db/pg_hint_plan/archive/REL14_1_4_0.zip \
84
- && unzip /tmp/pg_hint_plan.zip -d /tmp \
85
- && cd /tmp/pg_hint_plan-REL14_1_4_0 \
86
- && make && make install; \
87
- fi \
76
+ && export PG_PLAN_HINT_VERSION=$(echo $PG_SERVER_VERSION | sed 's/\. //' ) \
77
+ && wget --quiet -O /tmp/pg_hint_plan.zip \
78
+ https://github.com/ossc-db/pg_hint_plan/archive/PG${PG_PLAN_HINT_VERSION}.zip \
79
+ && unzip /tmp/pg_hint_plan.zip -d /tmp \
80
+ && cd /tmp/pg_hint_plan-PG${PG_PLAN_HINT_VERSION} \
81
+ && make && make install \
88
82
# powa extension
89
- && apt-get install --no-install-recommends -y \
90
- postgresql-${PG_SERVER_VERSION}-powa \
83
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-powa \
91
84
# pg_auth_mon extension
92
- && if [ $(echo "$PG_SERVER_VERSION < 14" | /usr/bin/bc) = "1" ]; then \
93
- git clone https://github.com/RafiaSabih/pg_auth_mon.git \
94
- && cd pg_auth_mon && USE_PGXS=1 make && USE_PGXS=1 make install; \
95
- fi \
85
+ && cd /tmp && git clone https://github.com/RafiaSabih/pg_auth_mon.git \
86
+ && cd pg_auth_mon && USE_PGXS=1 make && USE_PGXS=1 make install \
96
87
# timescaledb extension
97
- && if [ $(echo "$PG_SERVER_VERSION > 11" | /usr/bin/bc) = "1" ] && [ $(echo "$PG_SERVER_VERSION < 15" | /usr/bin/bc) = "1" ] ; then \
88
+ && if [ $(echo "$PG_SERVER_VERSION > 11" | /usr/bin/bc) = "1" ]; then \
98
89
echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list \
99
90
&& wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - \
100
91
&& apt-get update \
@@ -109,68 +100,59 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
109
100
elif [ "${PG_SERVER_VERSION}" = "14" ]; then CITUS_VERSION="11.1" ; \
110
101
elif [ "${PG_SERVER_VERSION}" = "15" ]; then CITUS_VERSION="11.1" ; \
111
102
fi \
112
- && curl -s https://install.citusdata.com/community/deb.sh | bash \
113
- && apt-get install --no-install-recommends -y \
114
- postgresql-"${PG_SERVER_VERSION}" -citus-"${CITUS_VERSION}" ; \
103
+ && curl -s https://install.citusdata.com/community/deb.sh | bash \
104
+ && apt-get install --no-install-recommends -y postgresql-"${PG_SERVER_VERSION}" -citus-"${CITUS_VERSION}" ; \
115
105
fi \
116
106
# hll extension
117
- && apt-get install --no-install-recommends -y \
118
- postgresql-"${PG_SERVER_VERSION}" -hll \
107
+ && apt-get install --no-install-recommends -y postgresql-"${PG_SERVER_VERSION}" -hll \
119
108
# topn extension
120
109
&& if [ $(echo "$PG_SERVER_VERSION > 9.6" | /usr/bin/bc) = "1" ]; then \
121
110
curl -s https://install.citusdata.com/community/deb.sh | bash \
122
- && apt-get install --no-install-recommends -y \
123
- postgresql-"${PG_SERVER_VERSION}" -topn; \
111
+ && apt-get install --no-install-recommends -y postgresql-"${PG_SERVER_VERSION}" -topn; \
124
112
fi \
125
113
# pg_timetable extension
126
114
&& wget https://github.com/cybertec-postgresql/pg_timetable/releases/download/v${PG_TIMETABLE_VERSION}/pg_timetable_${PG_TIMETABLE_VERSION}_Linux_x86_64.deb \
127
115
&& dpkg -i pg_timetable_${PG_TIMETABLE_VERSION}_Linux_x86_64.deb \
128
116
&& rm -rf pg_timetable_${PG_TIMETABLE_VERSION}_Linux_x86_64.deb \
129
117
# pg_show_plans extension
130
- && if [ $(echo "$PG_SERVER_VERSION < 15 " | /usr/bin/bc) = "1" ]; then \
131
- git clone https://github.com/cybertec-postgresql/pg_show_plans.git \
118
+ && if [ $(echo "$PG_SERVER_VERSION > 11 " | /usr/bin/bc) = "1" ]; then \
119
+ cd /tmp && git clone https://github.com/cybertec-postgresql/pg_show_plans.git \
132
120
&& cd pg_show_plans \
133
- && export USE_PGXS=1 && make && make install && cd .. && rm -rf pg_show_plans ; \
121
+ && export USE_PGXS=1 && make && make install; \
134
122
fi \
135
123
# pg_cron extension
136
- && if [ $(echo "$PG_SERVER_VERSION < 15" | /usr/bin/bc) = "1" ]; then \
137
- apt-get install --no-install-recommends -y \
138
- postgresql-${PG_SERVER_VERSION}-cron; \
139
- fi \
124
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-cron \
140
125
# postgresql_anonymizer extension
141
126
&& pgxn install ddlx && pgxn install postgresql_anonymizer \
142
127
# pg_stat_kcache extension
143
- && apt-get install --no-install-recommends -y \
144
- postgresql-${PG_SERVER_VERSION}-pg-stat-kcache \
128
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-pg-stat-kcache \
145
129
# pg_wait_sampling extension
146
- && apt-get install --no-install-recommends -y \
147
- postgresql-${PG_SERVER_VERSION}-pg-wait-sampling \
130
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-pg-wait-sampling \
148
131
# pg_qualstats extension
149
- && apt-get install --no-install-recommends -y \
150
- postgresql-${PG_SERVER_VERSION}-pg-qualstats \
132
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-pg-qualstats \
151
133
# bg_mon extension
152
134
&& apt-get install -y libevent-dev libbrotli-dev \
153
135
&& git clone https://github.com/CyberDem0n/bg_mon.git && cd bg_mon \
154
136
&& USE_PGXS=1 make && USE_PGXS=1 make install && cd .. \
155
137
# pgextwlist extension
156
- && apt-get install --no-install-recommends -y \
157
- postgresql-${PG_SERVER_VERSION}-pgextwlist \
138
+ && apt-get install --no-install-recommends -y postgresql-${PG_SERVER_VERSION}-pgextwlist \
158
139
# set_user extension
159
140
&& git clone https://github.com/pgaudit/set_user.git \
160
- && cd set_user && git checkout REL3_0_0 && make USE_PGXS=1 && make USE_PGXS=1 install \
141
+ && cd set_user && git checkout ${SET_USER_VERSION} && make USE_PGXS=1 && make USE_PGXS=1 install \
161
142
# logerrors extension
162
143
&& if [ $(echo "$PG_SERVER_VERSION > 9.6" | /usr/bin/bc) = "1" ]; then \
163
- # build logerrors v2.0
164
- if [ $(echo "$PG_SERVER_VERSION < 15" | /usr/bin/bc) = "1" ]; then \
165
- cd /tmp && wget https://github.com/munakoiso/logerrors/archive/v2.0.tar.gz \
166
- && tar -xf v2.0.tar.gz && rm v2.0.tar.gz && cd logerrors-2.0 \
167
- && USE_PGXS=1 make && USE_PGXS=1 make install; \
168
- # build logerrors from the master branch for PostgreSQL 15
169
- elif [ "${PG_SERVER_VERSION}" = "15" ]; then \
170
- cd /tmp && git clone https://github.com/munakoiso/logerrors.git \
171
- && cd logerrors \
172
- && USE_PGXS=1 make && USE_PGXS=1 make install; \
173
- fi \
144
+ cd /tmp && wget -O logerrors.tar.gz https://github.com/munakoiso/logerrors/archive/v${LOGERRORS_VERSION}.tar.gz \
145
+ && tar -xf logerrors.tar.gz && rm logerrors.tar.gz && cd logerrors-${LOGERRORS_VERSION} \
146
+ && USE_PGXS=1 make && USE_PGXS=1 make install; \
147
+ fi \
148
+ # pgvector extension
149
+ && if [ $(echo "$PG_SERVER_VERSION > 10" | /usr/bin/bc) = "1" ]; then \
150
+ cd /tmp && git clone --branch v${PGVECTOR_VERSION} https://github.com/pgvector/pgvector.git \
151
+ && cd pgvector && make OPTFLAGS="" install \
152
+ && mkdir /usr/share/doc/pgvector \
153
+ && cp LICENSE README.md /usr/share/doc/pgvector \
154
+ # it seems, v0.4.1 has incomplete setup process – we need to copy .sql manually
155
+ && cp sql/vector.sql /usr/share/postgresql/${PG_SERVER_VERSION}/extension/vector--${PGVECTOR_VERSION}.sql; \
174
156
fi \
175
157
# pgBackRest
176
158
&& apt-get install --no-install-recommends -y \
@@ -186,7 +168,7 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/partial \
186
168
&& apt-get clean -y autoclean \
187
169
&& rm -rf /var/lib/apt/lists/* \
188
170
# remove standard pgdata
189
- && rm -rf /var/lib/postgresql/${PG_SERVER_VERSION}/
171
+ && rm -rf /var/lib/postgresql/${PG_SERVER_VERSION}/
190
172
191
173
EXPOSE 5432
192
174
0 commit comments