forked from postgis/docker-postgis
/
Dockerfile
590 lines (546 loc) · 18.5 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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
# source: "Dockerfile.master.template"
# PLEASE DO NOT EDIT IT DIRECTLY.
#
# "Experimental"; solely for testing purposes. Anticipate frequent changes!
# This is a multi-stage Dockerfile, requiring a minimum Docker version of 17.05.
ARG PGIS1_BASE_IMAGE=postgres:16-bookworm
ARG PGIS1_POSTGIS_REPOSITORY=https://github.com/postgis/postgis.git
ARG PGIS1_GEOS_REPOSITORY=https://github.com/libgeos/geos.git
ARG PGIS1_GDAL_REPOSITORY=https://github.com/OSGeo/gdal.git
ARG PGIS1_PROJ_REPOSITORY=https://github.com/OSGeo/PROJ.git
ARG PGIS1_SFCGAL_REPOSITORY=https://gitlab.com/sfcgal/SFCGAL.git
ARG PGIS1_CGAL_REPOSITORY=https://github.com/CGAL/cgal.git
ARG PGIS1_POSTGIS_CHECKOUT=42f04a29effdd9e8280c7aba17420ba306fc73f4
ARG PGIS1_GEOS_CHECKOUT=e4a6e1af65f7d60fa63d7666f6cb000e365bb50f
ARG PGIS1_GDAL_CHECKOUT=3065c75de3a1af23688da064318be3a9550f1a94
ARG PGIS1_PROJ_CHECKOUT=e9c0e8c80595315921f2ae715a8ca6eca4a19558
ARG PGIS1_SFCGAL_CHECKOUT=cbcf0adaa6cecc80347345952b5c850a64d2db4f
ARG PGIS1_CGAL_CHECKOUT=08b5c909556c0c4e60b4b318ff0e5a3b8d6897b9
ARG PGIS1_POSTGIS_CHECKOUT_SHA1=42f04a29effdd9e8280c7aba17420ba306fc73f4
ARG PGIS1_GEOS_CHECKOUT_SHA1=e4a6e1af65f7d60fa63d7666f6cb000e365bb50f
ARG PGIS1_GDAL_CHECKOUT_SHA1=3065c75de3a1af23688da064318be3a9550f1a94
ARG PGIS1_PROJ_CHECKOUT_SHA1=e9c0e8c80595315921f2ae715a8ca6eca4a19558
ARG PGIS1_SFCGAL_CHECKOUT_SHA1=cbcf0adaa6cecc80347345952b5c850a64d2db4f
ARG PGIS1_CGAL_CHECKOUT_SHA1=08b5c909556c0c4e60b4b318ff0e5a3b8d6897b9
ARG PGIS1_BOOST_VERSION=1.74.0
ARG PGIS1_CMAKE_BUILD_TYPE=Release
FROM ${PGIS1_BASE_IMAGE} as builder
WORKDIR /
ARG PGIS1_BOOST_VERSION
ENV PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION}
# apt-get install
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libboost-atomic${PGIS1_BOOST_VERSION} \
libboost-chrono${PGIS1_BOOST_VERSION} \
libboost-date-time${PGIS1_BOOST_VERSION} \
libboost-filesystem${PGIS1_BOOST_VERSION} \
libboost-program-options${PGIS1_BOOST_VERSION} \
libboost-serialization${PGIS1_BOOST_VERSION} \
libboost-system${PGIS1_BOOST_VERSION} \
libboost-test${PGIS1_BOOST_VERSION} \
libboost-thread${PGIS1_BOOST_VERSION} \
libboost-timer${PGIS1_BOOST_VERSION} \
libcurl3-gnutls \
libexpat1 \
libgmp10 \
libgmpxx4ldbl \
libjson-c5 \
libmpfr6 \
libprotobuf-c1 \
libtiff6 \
libxml2 \
sqlite3 \
# build dependency
autoconf \
automake \
autotools-dev \
bison \
build-essential \
ca-certificates \
cmake \
g++ \
git \
libboost-all-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libpq-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
make \
pkg-config \
protobuf-c-compiler \
xsltproc \
# gdal+
libblosc-dev \
libcfitsio-dev \
libfreexl-dev \
libfyba-dev \
libhdf5-dev \
libkml-dev \
liblz4-dev \
liblzma-dev \
libnetcdf-dev \
libopenjp2-7-dev \
libqhull-dev \
libwebp-dev \
libzstd-dev
ARG PGIS1_CMAKE_BUILD_TYPE
ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE}
FROM builder as cgal-sfcgal-builder
# cgal & sfcgal
ARG PGIS1_SFCGAL_REPOSITORY
ENV PGIS1_SFCGAL_REPOSITORY ${PGIS1_SFCGAL_REPOSITORY}
ARG PGIS1_SFCGAL_CHECKOUT
ENV PGIS1_SFCGAL_CHECKOUT ${PGIS1_SFCGAL_CHECKOUT}
ARG PGIS1_SFCGAL_CHECKOUT_SHA1
ARG PGIS1_CGAL_REPOSITORY
ENV PGIS1_CGAL_REPOSITORY ${PGIS1_CGAL_REPOSITORY}
ARG PGIS1_CGAL_CHECKOUT
ENV PGIS1_CGAL_CHECKOUT ${PGIS1_CGAL_CHECKOUT}
ARG PGIS1_CGAL_CHECKOUT_SHA1
RUN set -eux \
&& cd /usr/src \
&& mkdir cgal \
&& cd cgal \
&& git init \
&& git remote add origin ${PGIS1_CGAL_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_CGAL_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_CGAL_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_cgal_last_commit.txt \
&& cd /usr/src \
&& mkdir SFCGAL \
&& cd SFCGAL \
&& git init \
&& git remote add origin ${PGIS1_SFCGAL_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_SFCGAL_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_SFCGAL_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_sfcgal_last_commit.txt \
&& mkdir cmake-build \
&& cd cmake-build \
&& cmake .. \
-DCGAL_DIR=/usr/src/cgal \
-DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \
-DSFCGAL_BUILD_BENCH=OFF \
-DSFCGAL_BUILD_EXAMPLES=OFF \
-DSFCGAL_BUILD_TESTS=OFF \
-DSFCGAL_WITH_OSG=OFF \
&& make -j$(nproc) \
&& make install \
# clean
&& rm -fr /usr/src/SFCGAL \
&& rm -fr /usr/src/cgal
FROM builder as proj-builder
# proj
ARG PGIS1_PROJ_REPOSITORY
ENV PGIS1_PROJ_REPOSITORY ${PGIS1_PROJ_REPOSITORY}
ARG PGIS1_PROJ_CHECKOUT
ENV PGIS1_PROJ_CHECKOUT ${PGIS1_PROJ_CHECKOUT}
ARG PGIS1_PROJ_CHECKOUT_SHA1
RUN set -eux \
&& cd /usr/src \
&& mkdir PROJ \
&& cd PROJ \
&& git init \
&& git remote add origin ${PGIS1_PROJ_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_PROJ_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_PROJ_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_proj_last_commit.txt \
# check the autotools exist? https://github.com/OSGeo/PROJ/pull/3027
&& if [ -f "autogen.sh" ] ; then \
set -eux \
&& echo "autotools version: 'autogen.sh' exists! Older version!" \
&& ./autogen.sh \
&& ./configure --disable-static \
&& make -j$(nproc) \
&& make install \
; \
else \
set -eux \
&& echo "cmake version: 'autogen.sh' does not exists! Newer version!" \
&& mkdir build \
&& cd build \
&& cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
&& make -j$(nproc) \
&& make install \
; \
fi \
\
&& rm -fr /usr/src/PROJ
FROM builder as geos-builder
# geos
ARG PGIS1_GEOS_REPOSITORY
ENV PGIS1_GEOS_REPOSITORY ${PGIS1_GEOS_REPOSITORY}
ARG PGIS1_GEOS_CHECKOUT
ENV PGIS1_GEOS_CHECKOUT ${PGIS1_GEOS_CHECKOUT}
ARG PGIS1_GEOS_CHECKOUT_SHA1
RUN set -eux \
&& cd /usr/src \
&& mkdir geos \
&& cd geos \
&& git init \
&& git remote add origin ${PGIS1_GEOS_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_GEOS_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_GEOS_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_geos_last_commit.txt \
&& mkdir cmake-build \
&& cd cmake-build \
&& cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/geos
FROM builder as stage0-builder
COPY --from=cgal-sfcgal-builder /_pgis*.* /
COPY --from=cgal-sfcgal-builder /usr/local /usr/local
COPY --from=proj-builder /_pgis*.* /
COPY --from=proj-builder /usr/local /usr/local
COPY --from=geos-builder /_pgis*.* /
COPY --from=geos-builder /usr/local /usr/local
# gdal
ARG PGIS1_GDAL_REPOSITORY
ENV PGIS1_GDAL_REPOSITORY ${PGIS1_GDAL_REPOSITORY}
ARG PGIS1_GDAL_CHECKOUT
ENV PGIS1_GDAL_CHECKOUT ${PGIS1_GDAL_CHECKOUT}
ARG PGIS1_GDAL_CHECKOUT_SHA1
RUN set -eux \
&& cd /usr/src \
&& mkdir gdal \
&& cd gdal \
&& git init \
&& git remote add origin ${PGIS1_GDAL_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_GDAL_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_GDAL_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_gdal_last_commit.txt \
\
# gdal project directory structure - has been changed !
&& if [ -d "gdal" ] ; then \
echo "Directory 'gdal' dir exists -> older version!" ; \
cd gdal ; \
else \
echo "Directory 'gdal' does not exists! Newer version! " ; \
fi \
\
&& if [ -f "./autogen.sh" ]; then \
# Building with autoconf ( old/deprecated )
set -eux \
&& ./autogen.sh \
&& ./configure --disable-static \
; \
else \
# Building with cmake
set -eux \
&& mkdir build \
&& cd build \
# config based on: https://salsa.debian.org/debian-gis-team/gdal/-/blob/master/debian/rules
&& cmake .. -DCMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} -DBUILD_TESTING=OFF \
-DBUILD_DOCS=OFF \
\
-DGDAL_HIDE_INTERNAL_SYMBOLS=ON \
-DRENAME_INTERNAL_TIFF_SYMBOLS=ON \
# -DGDAL_USE_ARROW=ON \
-DGDAL_USE_BLOSC=ON \
-DGDAL_USE_CFITSIO=ON \
-DGDAL_USE_CURL=ON \
-DGDAL_USE_DEFLATE=ON \
-DGDAL_USE_EXPAT=ON \
-DGDAL_USE_FREEXL=ON \
-DGDAL_USE_FYBA=ON \
-DGDAL_USE_GEOS=ON \
-DGDAL_USE_HDF5=ON \
-DGDAL_USE_JSONC=ON \
-DGDAL_USE_LERC_INTERNAL=ON \
-DGDAL_USE_LIBKML=ON \
-DGDAL_USE_LIBLZMA=ON \
-DGDAL_USE_LZ4=ON \
-DGDAL_USE_NETCDF=ON \
-DGDAL_USE_OPENJPEG=ON \
# -DGDAL_USE_PARQUET=ON \
-DGDAL_USE_POSTGRESQL=ON \
-DGDAL_USE_QHULL=ON \
-DGDAL_USE_SQLITE3=ON \
-DGDAL_USE_TIFF=ON \
-DGDAL_USE_WEBP=ON \
-DGDAL_USE_ZLIB=ON \
-DGDAL_USE_ZSTD=ON \
\
# OFF and Not working https://github.com/OSGeo/gdal/issues/7100
# -DRENAME_INTERNAL_GEOTIFF_SYMBOLS=ON \
-DGDAL_USE_ECW=OFF \
-DGDAL_USE_GEOTIFF=OFF \
-DGDAL_USE_HEIF=OFF \
-DGDAL_USE_SPATIALITE=OFF \
; \
fi \
\
&& make -j$(nproc) \
&& make install \
&& cd / \
&& rm -fr /usr/src/gdal
# Minimal command line test.
RUN set -eux \
&& ldconfig \
&& cs2cs \
&& ldd $(which gdalinfo) \
&& gdalinfo --version \
&& geos-config --version \
&& ogr2ogr --version \
&& proj \
&& sfcgal-config --version \
&& pcre-config --version
# -------------------------------------------
# final stage
# -------------------------------------------
FROM ${PGIS1_BASE_IMAGE}
LABEL maintainer="PostGIS Project - https://postgis.net" \
org.opencontainers.image.description="PostGIS - 16-master spatial database extension with PostgreSQL 16 bookworm" \
org.opencontainers.image.source="https://github.com/postgis/docker-postgis"
ARG PGIS1_CMAKE_BUILD_TYPE
ARG PGIS1_BASE_IMAGE
ARG PGIS1_BOOST_VERSION
ENV PGIS1_CMAKE_BUILD_TYPE=${PGIS1_CMAKE_BUILD_TYPE} \
PGIS1_BASE_IMAGE=${PGIS1_BASE_IMAGE} \
PGIS1_BOOST_VERSION=${PGIS1_BOOST_VERSION}
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libboost-atomic${PGIS1_BOOST_VERSION} \
libboost-chrono${PGIS1_BOOST_VERSION} \
libboost-date-time${PGIS1_BOOST_VERSION} \
libboost-filesystem${PGIS1_BOOST_VERSION} \
libboost-program-options${PGIS1_BOOST_VERSION} \
libboost-serialization${PGIS1_BOOST_VERSION} \
libboost-system${PGIS1_BOOST_VERSION} \
libboost-test${PGIS1_BOOST_VERSION} \
libboost-thread${PGIS1_BOOST_VERSION} \
libboost-timer${PGIS1_BOOST_VERSION} \
libcurl3-gnutls \
libexpat1 \
libgmp10 \
libgmpxx4ldbl \
libjson-c5 \
libmpfr6 \
libpcre3 \
libprotobuf-c1 \
libtiff6 \
libxml2 \
sqlite3 \
# gdal+
libblosc1 \
libcfitsio10 \
libfreexl1 \
libfyba0 \
libhdf5-103-1 \
libkmlbase1 \
libkmldom1 \
libkmlengine1 \
libnetcdf19 \
libopenjp2-7 \
libqhull-r8.0 \
netcdf-bin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=stage0-builder /_pgis*.* /
COPY --from=stage0-builder /usr/local /usr/local
ARG PGIS1_GDAL_CHECKOUT
ARG PGIS1_GDAL_REPOSITORY
ARG PGIS1_GEOS_CHECKOUT
ARG PGIS1_GEOS_REPOSITORY
ARG PGIS1_PROJ_CHECKOUT
ARG PGIS1_PROJ_REPOSITORY
ARG PGIS1_SFCGAL_CHECKOUT
ARG PGIS1_SFCGAL_REPOSITORY
ARG PGIS1_CGAL_REPOSITORY
ARG PGIS1_CGAL_CHECKOUT
ARG PGIS1_POSTGIS_CHECKOUT
ARG PGIS1_POSTGIS_REPOSITORY
ARG PGIS1_POSTGIS_CHECKOUT_SHA1
ENV PGIS1_GDAL_CHECKOUT=${PGIS1_GDAL_CHECKOUT} \
PGIS1_GDAL_REPOSITORY=${PGIS1_GDAL_REPOSITORY} \
PGIS1_GEOS_CHECKOUT=${PGIS1_GEOS_CHECKOUT} \
PGIS1_GEOS_REPOSITORY=${PGIS1_GEOS_REPOSITORY} \
PGIS1_PROJ_CHECKOUT=${PGIS1_PROJ_CHECKOUT} \
PGIS1_PROJ_REPOSITORY=${PGIS1_PROJ_REPOSITORY} \
PGIS1_CGAL_CHECKOUT=${PGIS1_CGAL_CHECKOUT} \
PGIS1_CGAL_REPOSITORY=${PGIS1_CGAL_REPOSITORY} \
PGIS1_SFCGAL_CHECKOUT=${PGIS1_SFCGAL_CHECKOUT} \
PGIS1_SFCGAL_REPOSITORY=${PGIS1_SFCGAL_REPOSITORY} \
PGIS1_POSTGIS_CHECKOUT=${PGIS1_POSTGIS_CHECKOUT} \
PGIS1_POSTGIS_REPOSITORY=${PGIS1_POSTGIS_REPOSITORY}
# Minimal command line test ( fail fast )
RUN set -eux \
&& ldconfig \
&& cs2cs \
&& ldd $(which gdalinfo) \
&& gdalinfo --version \
&& gdal-config --formats \
&& geos-config --version \
&& ogr2ogr --version \
&& proj \
&& sfcgal-config --version \
\
# Testing ogr2ogr PostgreSQL driver.
&& ogr2ogr --formats | grep -q "PostgreSQL/PostGIS" && exit 0 \
|| echo "ogr2ogr missing PostgreSQL driver" && exit 1
# temporary workaround for : nitdb: invalid locale settings; check LANG and LC_* environment variables
# https://github.com/docker-library/postgres/issues/1112#issuecomment-1746076388
RUN set -eux \
&& echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && locale-gen
RUN set -eux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
bison \
build-essential \
ca-certificates \
cmake \
docbook-xml \
docbook5-xml \
g++ \
git \
libboost-all-dev \
libcunit1-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
libxml2-utils \
make \
pkg-config \
postgresql-server-dev-$PG_MAJOR \
protobuf-c-compiler \
xsltproc \
&& cd \
# postgis
&& cd /usr/src \
&& mkdir postgis \
&& cd postgis \
&& git init \
&& git remote add origin ${PGIS1_POSTGIS_REPOSITORY} \
&& git fetch --depth 1 origin ${PGIS1_POSTGIS_CHECKOUT} \
&& git checkout FETCH_HEAD \
# Verify that the commit hash matches the known good one
&& if [ "$(git rev-parse HEAD)" != "$PGIS1_POSTGIS_CHECKOUT_SHA1" ]; then exit 1; fi \
&& git log -1 > /_pgis_last_commit.txt \
&& ./autogen.sh \
# configure options taken from:
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
&& ./configure \
--enable-lto \
&& make -j$(nproc) \
&& make install \
# refresh proj data - workarounds: https://trac.osgeo.org/postgis/ticket/5316
&& projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \
&& projsync --system-directory --file us_noaa_eshpgn \
&& projsync --system-directory --file us_noaa_prvi \
&& projsync --system-directory --file us_noaa_wmhpgn \
# regress check
&& mkdir /tempdb \
&& chown -R postgres:postgres /tempdb \
&& su postgres -c 'pg_ctl -D /tempdb init' \
&& su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \
&& ldconfig \
&& cd regress \
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
\
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \
&& su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \
&& su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \
&& su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \
\
&& su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \
&& rm -rf /tempdb \
&& rm -rf /tmp/logfile \
&& rm -rf /tmp/pgis_reg \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apt-get purge -y --autoremove \
autoconf \
automake \
autotools-dev \
bison \
build-essential \
cmake \
docbook-xml \
docbook5-xml \
g++ \
git \
libboost-all-dev \
libcurl4-gnutls-dev \
libgmp-dev \
libjson-c-dev \
libmpfr-dev \
libpcre3-dev \
libprotobuf-c-dev \
libsqlite3-dev \
libtiff-dev \
libtool \
libxml2-dev \
libxml2-utils \
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
# last final test
RUN set -eux \
&& ldconfig \
&& cs2cs \
&& ldd $(which gdalinfo) \
&& gdalinfo --version \
&& gdal-config --formats \
&& geos-config --version \
&& ogr2ogr --version \
&& proj \
&& sfcgal-config --version \
\
# Is the "ca-certificates" package installed? (for accessing remote raster files)
# https://github.com/postgis/docker-postgis/issues/307
&& dpkg-query -W -f='${Status}' ca-certificates 2>/dev/null | grep -c "ok installed" \
\
# list last commits.
&& find /_pgis_*_last_commit.txt -type f -print -exec cat {} \; \
# list postgresql, postgis version
&& cat _pgis_full_version.txt