forked from kartoza/docker-postgis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.master.template
282 lines (261 loc) · 6.78 KB
/
Dockerfile.master.template
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# "experimental" ; only for testing!
# multi-stage dockerfile; minimal docker version >= 17.05
FROM postgres:%%PG_MAJOR%% as builder
LABEL maintainer="PostGIS Project - https://postgis.net"
WORKDIR /
# apt-get install
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libboost-atomic%%BOOST_VERSION%% \
libboost-chrono%%BOOST_VERSION%% \
libboost-date-time%%BOOST_VERSION%% \
libboost-filesystem%%BOOST_VERSION%% \
libboost-program-options%%BOOST_VERSION%% \
libboost-serialization%%BOOST_VERSION%% \
libboost-system%%BOOST_VERSION%% \
libboost-test%%BOOST_VERSION%% \
libboost-thread%%BOOST_VERSION%% \
libboost-timer%%BOOST_VERSION%% \
libcgal%%CDAL_VERSION%% \
libcurl3-gnutls \
libexpat1 \
libgmp10 \
libgmpxx4ldbl \
libjson-c3 \
libmpfr6 \
libprotobuf-c1 \
libtiff5 \
libxml2 \
sqlite3 \
# build dependency
autoconf \
automake \
autotools-dev \
bison \
build-essential \
ca-certificates \
cmake \
g++ \
git \
libboost-all-dev \
libcgal-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
make \
pkg-config \
protobuf-c-compiler \
xsltproc
# sfcgal
ENV SFCGAL_VERSION master
ENV SFCGAL_GIT_HASH %%SFCGAL_GIT_HASH%%
RUN set -ex \
&& mkdir -p /usr/src \
&& cd /usr/src \
&& git clone https://gitlab.com/Oslandia/SFCGAL.git \
&& cd SFCGAL \
&& git checkout ${SFCGAL_GIT_HASH} \
&& mkdir cmake-build \
&& cd cmake-build \
&& cmake .. \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/SFCGAL
# proj
ENV PROJ_VERSION master
ENV PROJ_GIT_HASH %%PROJ_GIT_HASH%%
RUN set -ex \
&& cd /usr/src \
&& git clone https://github.com/OSGeo/PROJ.git \
&& cd PROJ \
&& git checkout ${PROJ_GIT_HASH} \
&& ./autogen.sh \
&& ./configure --disable-static \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/PROJ
# geos
ENV GEOS_VERSION master
ENV GEOS_GIT_HASH %%GEOS_GIT_HASH%%
RUN set -ex \
&& cd /usr/src \
&& git clone https://github.com/libgeos/geos.git \
&& cd geos \
&& git checkout ${GEOS_GIT_HASH} \
&& mkdir cmake-build \
&& cd cmake-build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/geos
# gdal
ENV GDAL_VERSION master
ENV GDAL_GIT_HASH %%GDAL_GIT_HASH%%
RUN set -ex \
&& cd /usr/src \
&& git clone https://github.com/OSGeo/gdal.git \
&& cd gdal \
&& git checkout ${GDAL_GIT_HASH} \
&& cd gdal \
&& ./autogen.sh \
&& ./configure --disable-static \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/gdal
# Minimal command line test.
RUN set -ex \
&& ldconfig \
&& cs2cs \
&& gdalinfo --version \
&& geos-config --version \
&& ogr2ogr --version \
&& proj \
&& sfcgal-config --version \
&& pcre-config --version
FROM postgres:%%PG_MAJOR%%
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libboost-atomic%%BOOST_VERSION%% \
libboost-chrono%%BOOST_VERSION%% \
libboost-date-time%%BOOST_VERSION%% \
libboost-filesystem%%BOOST_VERSION%% \
libboost-program-options%%BOOST_VERSION%% \
libboost-serialization%%BOOST_VERSION%% \
libboost-system%%BOOST_VERSION%% \
libboost-test%%BOOST_VERSION%% \
libboost-thread%%BOOST_VERSION%% \
libboost-timer%%BOOST_VERSION%% \
libcgal%%CDAL_VERSION%% \
libcurl3-gnutls \
libexpat1 \
libgmp10 \
libgmpxx4ldbl \
libjson-c3 \
libmpfr6 \
libpcre3 \
libprotobuf-c1 \
libtiff5 \
libxml2 \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
ENV SFCGAL_GIT_HASH %%SFCGAL_GIT_HASH%%
ENV PROJ_GIT_HASH %%PROJ_GIT_HASH%%
ENV GEOS_GIT_HASH %%GEOS_GIT_HASH%%
ENV GDAL_GIT_HASH %%GDAL_GIT_HASH%%
# Minimal command line test.
RUN set -ex \
&& ldconfig \
&& cs2cs \
&& gdalinfo --version \
&& geos-config --version \
&& ogr2ogr --version \
&& proj \
&& sfcgal-config --version
# install postgis
ENV POSTGIS_VERSION master
ENV POSTGIS_GIT_HASH %%POSTGIS_GIT_HASH%%
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
bison \
build-essential \
ca-certificates \
cmake \
g++ \
git \
libboost-all-dev \
libcgal-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
make \
pkg-config \
postgresql-server-dev-$PG_MAJOR \
protobuf-c-compiler \
xsltproc \
&& cd \
# postgis
&& cd /usr/src/ \
&& git clone https://git.osgeo.org/gitea/postgis/postgis.git \
&& cd postgis \
&& git checkout ${POSTGIS_GIT_HASH} \
&& ./autogen.sh \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure \
# --with-gui \
--with-pcredir="$(pcre-config --prefix)" \
&& make -j$(nproc) \
&& make install \
# regress check
&& mkdir /tempdb \
&& chown -R postgres:postgres /tempdb \
&& su postgres -c 'pg_ctl -D /tempdb init' \
&& su postgres -c 'pg_ctl -D /tempdb start' \
&& ldconfig \
&& cd regress \
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
&& su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \
&& rm -rf /tempdb \
&& rm -rf /tmp/pgis_reg \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apt-get purge -y --autoremove \
autoconf \
automake \
autotools-dev \
bison \
build-essential \
ca-certificates \
cmake \
g++ \
git \
libboost-all-dev \
libcgal-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
make \
pkg-config \
postgresql-server-dev-$PG_MAJOR \
protobuf-c-compiler \
xsltproc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
COPY ./update-postgis.sh /usr/local/bin