forked from ivanlonel/postgis-with-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
238 lines (187 loc) · 7.91 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
ARG BASE_IMAGE_TAG=latest
FROM postgis/postgis:$BASE_IMAGE_TAG as base-image
ENV ORACLE_HOME /usr/lib/oracle/client
ENV PATH $PATH:${ORACLE_HOME}
FROM base-image as basic-deps
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl
FROM basic-deps as powa-scripts
WORKDIR /tmp/powa
RUN (curl --fail -LOJ "https://raw.githubusercontent.com/powa-team/powa-podman/master/powa-archivist/$PG_MAJOR/setup_powa-archivist.sh" || \
curl --fail -LOJ "https://raw.githubusercontent.com/powa-team/powa-podman/master/powa-archivist-git/setup_powa-archivist.sh") && \
(curl --fail -LOJ "https://raw.githubusercontent.com/powa-team/powa-podman/master/powa-archivist/$PG_MAJOR/install_all_powa_ext.sql" || \
curl --fail -LOJ "https://raw.githubusercontent.com/powa-team/powa-podman/master/powa-archivist-git/install_all_powa_ext.sql")
FROM basic-deps as common-deps
# /var/lib/apt/lists/ still has the indexes from parent stage, so there's no need to run apt-get update again.
# (unless the parent stage cache is not invalidated...)
RUN apt-get install -y --no-install-recommends \
gcc \
make \
postgresql-server-dev-$PG_MAJOR
FROM common-deps as build-timescaledb
WORKDIR /tmp/timescaledb
RUN apt-get install -y --no-install-recommends cmake libkrb5-dev && \
ASSET_NAME=$(basename $(curl -LIs -o /dev/null -w %{url_effective} https://github.com/timescale/timescaledb/releases/latest)) && \
curl --fail -L "https://github.com/timescale/timescaledb/archive/${ASSET_NAME}.tar.gz" | tar -zx --strip-components=1 -C . && \
./bootstrap
WORKDIR /tmp/timescaledb/build
RUN make && \
make install
FROM common-deps as build-pgvector
WORKDIR /tmp
ARG REPO=https://github.com/pgvector/pgvector.git
RUN apt-get install -y --no-install-recommends git && \
git clone $REPO --single-branch --branch $(git ls-remote --tags --refs $REPO | tail -n1 | cut -d/ -f3)
WORKDIR /tmp/pgvector
RUN make clean && \
make OPTFLAGS="" && \
make install
FROM common-deps as build-sqlite_fdw
WORKDIR /tmp/sqlite_fdw
RUN apt-get install -y --no-install-recommends libsqlite3-dev && \
ASSET_NAME=$(basename $(curl -LIs -o /dev/null -w %{url_effective} https://github.com/pgspider/sqlite_fdw/releases/latest)) && \
curl --fail -L "https://github.com/pgspider/sqlite_fdw/archive/${ASSET_NAME}.tar.gz" | tar -zx --strip-components=1 -C . && \
make USE_PGXS=1 && \
make USE_PGXS=1 install
FROM common-deps as build-oracle_fdw
# Latest version
ARG ORACLE_CLIENT_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
ARG ORACLE_SQLPLUS_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip
ARG ORACLE_SDK_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip
RUN apt-get install -y --no-install-recommends unzip && \
# instant client
curl --fail -L -o instant_client.zip ${ORACLE_CLIENT_URL} && \
unzip instant_client.zip && \
# sqlplus
curl --fail -L -o sqlplus.zip ${ORACLE_SQLPLUS_URL} && \
unzip sqlplus.zip && \
# sdk
curl --fail -L -o sdk.zip ${ORACLE_SDK_URL} && \
unzip sdk.zip && \
# install
mkdir -p ${ORACLE_HOME} && \
mv ./instantclient*/* ${ORACLE_HOME}
# Install oracle_fdw
WORKDIR /tmp/oracle_fdw
RUN ASSET_NAME=$(basename $(curl -LIs -o /dev/null -w %{url_effective} https://github.com/laurenz/oracle_fdw/releases/latest)) && \
curl --fail -L "https://github.com/laurenz/oracle_fdw/archive/${ASSET_NAME}.tar.gz" | tar -zx --strip-components=1 -C . && \
make && \
make install
FROM base-image as final-stage
# libaio1 is a runtime requirement for the Oracle client that oracle_fdw uses
# libsqlite3-mod-spatialite is a runtime requirement for using spatialite with sqlite_fdw
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libaio1 \
libsqlite3-mod-spatialite \
pgagent \
postgresql-$PG_MAJOR-asn1oid \
postgresql-$PG_MAJOR-cron \
postgresql-$PG_MAJOR-dirtyread \
postgresql-$PG_MAJOR-debversion \
postgresql-$PG_MAJOR-extra-window-functions \
postgresql-$PG_MAJOR-first-last-agg \
postgresql-$PG_MAJOR-hll \
postgresql-$PG_MAJOR-icu-ext \
postgresql-$PG_MAJOR-ip4r \
postgresql-$PG_MAJOR-jsquery \
postgresql-$PG_MAJOR-mysql-fdw \
postgresql-$PG_MAJOR-numeral \
postgresql-$PG_MAJOR-ogr-fdw \
postgresql-$PG_MAJOR-orafce \
# postgresql-$PG_MAJOR-partman \
postgresql-$PG_MAJOR-periods \
postgresql-$PG_MAJOR-pg-fact-loader \
postgresql-$PG_MAJOR-pgaudit \
postgresql-$PG_MAJOR-pgauditlogtofile \
postgresql-$PG_MAJOR-pgfincore \
postgresql-$PG_MAJOR-pgl-ddl-deploy \
postgresql-$PG_MAJOR-pglogical \
postgresql-$PG_MAJOR-pglogical-ticker \
postgresql-$PG_MAJOR-pgmemcache \
postgresql-$PG_MAJOR-pgmp \
postgresql-$PG_MAJOR-pgpcre \
postgresql-$PG_MAJOR-pgq-node \
postgresql-$PG_MAJOR-pgrouting \
# postgresql-$PG_MAJOR-pgsphere \
postgresql-$PG_MAJOR-pgtap \
postgresql-$PG_MAJOR-pldebugger \
# postgresql-$PG_MAJOR-pljava \
# postgresql-$PG_MAJOR-pllua \
postgresql-$PG_MAJOR-plpgsql-check \
postgresql-$PG_MAJOR-plproxy \
# postgresql-$PG_MAJOR-plr \
postgresql-$PG_MAJOR-plsh \
postgresql-$PG_MAJOR-pointcloud \
postgresql-$PG_MAJOR-prefix \
# postgresql-$PG_MAJOR-preprepare \
postgresql-$PG_MAJOR-prioritize \
# postgresql-$PG_MAJOR-python3-multicorn \
# postgresql-$PG_MAJOR-q3c \
postgresql-$PG_MAJOR-rational \
postgresql-$PG_MAJOR-repack \
postgresql-$PG_MAJOR-rum \
postgresql-$PG_MAJOR-semver \
postgresql-$PG_MAJOR-similarity \
postgresql-$PG_MAJOR-tablelog \
postgresql-$PG_MAJOR-tdigest \
postgresql-$PG_MAJOR-tds-fdw \
postgresql-$PG_MAJOR-toastinfo \
postgresql-$PG_MAJOR-unit \
# postgresql-$PG_MAJOR-wal2json \
postgresql-plperl-$PG_MAJOR \
postgresql-plpython3-$PG_MAJOR \
# extensions below are all here for PoWA
postgresql-$PG_MAJOR-hypopg \
postgresql-$PG_MAJOR-pg-qualstats \
postgresql-$PG_MAJOR-pg-stat-kcache \
postgresql-$PG_MAJOR-pg-track-settings \
postgresql-$PG_MAJOR-pg-wait-sampling \
postgresql-$PG_MAJOR-powa && \
apt-get purge -y --auto-remove && \
rm -rf /var/lib/apt/lists/*
COPY --from=powa-scripts \
/tmp/powa/setup_powa-archivist.sh \
/docker-entrypoint-initdb.d/setup_powa-archivist.sh
COPY --from=powa-scripts \
/tmp/powa/install_all_powa_ext.sql \
/usr/local/src/install_all_powa_ext.sql
COPY --from=build-timescaledb \
/usr/share/postgresql/$PG_MAJOR/extension/timescaledb* \
/usr/share/postgresql/$PG_MAJOR/extension/
COPY --from=build-timescaledb \
/usr/lib/postgresql/$PG_MAJOR/lib/timescaledb* \
/usr/lib/postgresql/$PG_MAJOR/lib/
COPY --from=build-pgvector \
/usr/share/postgresql/$PG_MAJOR/extension/vector* \
/usr/share/postgresql/$PG_MAJOR/extension/
COPY --from=build-pgvector \
/usr/lib/postgresql/$PG_MAJOR/lib/vector* \
/usr/lib/postgresql/$PG_MAJOR/lib/
COPY --from=build-sqlite_fdw \
/usr/share/postgresql/$PG_MAJOR/extension/sqlite_fdw* \
/usr/share/postgresql/$PG_MAJOR/extension/
COPY --from=build-sqlite_fdw \
/usr/lib/postgresql/$PG_MAJOR/lib/bitcode/sqlite_fdw.index.bc \
/usr/lib/postgresql/$PG_MAJOR/lib/bitcode/sqlite_fdw.index.bc
COPY --from=build-sqlite_fdw \
/usr/lib/postgresql/$PG_MAJOR/lib/bitcode/sqlite_fdw \
/usr/lib/postgresql/$PG_MAJOR/lib/bitcode/sqlite_fdw
COPY --from=build-sqlite_fdw \
/usr/lib/postgresql/$PG_MAJOR/lib/sqlite_fdw.so \
/usr/lib/postgresql/$PG_MAJOR/lib/sqlite_fdw.so
COPY --from=build-oracle_fdw \
/usr/share/postgresql/$PG_MAJOR/extension/oracle_fdw* \
/usr/share/postgresql/$PG_MAJOR/extension/
COPY --from=build-oracle_fdw \
/usr/share/doc/postgresql-doc-$PG_MAJOR/extension/README.oracle_fdw \
/usr/share/doc/postgresql-doc-$PG_MAJOR/extension/README.oracle_fdw
COPY --from=build-oracle_fdw \
/usr/lib/postgresql/$PG_MAJOR/lib/oracle_fdw.so \
/usr/lib/postgresql/$PG_MAJOR/lib/oracle_fdw.so
COPY --from=build-oracle_fdw ${ORACLE_HOME} ${ORACLE_HOME}
RUN echo ${ORACLE_HOME} > /etc/ld.so.conf.d/oracle_instantclient.conf && \
ldconfig
COPY ./conf.sh /docker-entrypoint-initdb.d/z_conf.sh