Skip to content

Commit 43f0be5

Browse files
committed
dev-update-images: Changed the base PostGIS image from the imresamu/postgis bundle one to the pgrouting/pgrouting-extra one as we don't use the other extensions. The TimeScaleDB extension in particular was adding some bloat.
1 parent c1f974e commit 43f0be5

File tree

3 files changed

+30
-51
lines changed

3 files changed

+30
-51
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2154
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
# Create the 'template_postgis' template db
9+
"${psql[@]}" <<-'EOSQL'
10+
CREATE DATABASE template_postgis IS_TEMPLATE true;
11+
EOSQL
12+
13+
# Load PostGIS into both template_database and $POSTGRES_DB
14+
for DB in template_postgis "$POSTGRES_DB"; do
15+
echo "Loading PostGIS extensions into $DB"
16+
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
17+
CREATE EXTENSION IF NOT EXISTS postgis;
18+
CREATE EXTENSION IF NOT EXISTS postgis_topology;
19+
-- Reconnect to update pg_setting.resetval
20+
-- See https://github.com/postgis/docker-postgis/issues/288
21+
\c
22+
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
23+
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
24+
EOSQL
25+
done

third-party/postgis/Dockerfile

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,11 @@
1-
# Overridden with postgis image that has pgrouting added as one of several bundled extensions
2-
FROM imresamu/postgis:15-3.4-bundle-bookworm AS pgrouting_extra
3-
4-
# Copied from https://github.com/pgRouting/docker-pgrouting/blob/dd6672dbe7e6a413a67b8a592f458067771d697d/15-3.3-3.4/extra/Dockerfile
5-
ENV OSM2PGROUTING_VERSION 2.3.8
6-
7-
RUN apt update \
8-
&& apt install -y \
9-
libpqxx-6.4 \
10-
&& apt install -y \
11-
build-essential \
12-
cmake \
13-
wget \
14-
libboost-program-options-dev \
15-
libexpat1 \
16-
libexpat-dev \
17-
libosmium2-dev \
18-
libpqxx-dev \
19-
zlib1g-dev \
20-
&& cd /usr/local/src \
21-
&& wget https://github.com/pgRouting/osm2pgrouting/archive/refs/tags/v${OSM2PGROUTING_VERSION}.tar.gz \
22-
&& tar xvf v${OSM2PGROUTING_VERSION}.tar.gz \
23-
&& cd osm2pgrouting-${OSM2PGROUTING_VERSION} \
24-
&& mkdir build \
25-
&& cd build \
26-
&& cmake .. \
27-
&& make \
28-
&& make install \
29-
&& cd ../tools/osmium/ \
30-
&& mkdir build \
31-
&& cd build \
32-
&& cmake .. \
33-
&& make \
34-
&& make install \
35-
&& cd /usr/local/src \
36-
&& rm -rf ./* \
37-
&& apt purge -y --autoremove \
38-
build-essential \
39-
cmake \
40-
wget \
41-
libexpat-dev \
42-
libosmium2-dev \
43-
libpqxx-dev \
44-
zlib1g-dev \
45-
&& apt autoremove -y \
46-
&& rm -rf /var/lib/apt/lists/*
47-
481
# Copied from https://github.com/3dcitydb/3dcitydb/blob/c7ca7df2f953e7b4a4a1d1b88f3fdceeb9d3247e/postgresql/Dockerfile
492
# 3DCityDB PostGIS Dockerfile #################################################
503
# Official website https://www.3dcitydb.net
514
# GitHub https://github.com/3dcitydb
525
###############################################################################
536

54-
# Base image
55-
FROM pgrouting_extra
7+
# Base image changed to pgrouting-extra
8+
FROM pgrouting/pgrouting-extra:15-3.5-3.8.0
569

5710
# Set 3DCityDB version
5811
ARG CITYDB_VERSION='4.4.0'
@@ -61,7 +14,8 @@ ENV CITYDBVERSION=${CITYDB_VERSION}
6114
# Copy SQL scripts
6215
WORKDIR /3dcitydb
6316
COPY SQLScripts .
64-
COPY DockerScripts/3dcitydb-initdb.sh /docker-entrypoint-initdb.d/
17+
COPY DockerScripts/* /docker-entrypoint-initdb.d/
18+
RUN chmod 644 /docker-entrypoint-initdb.d/10_postgis.sh
6519

6620
# Set labels
6721
LABEL maintainer="Bruno Willenborg"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
services:
22
postgis:
3-
image: ghcr.io/cambridge-cares/cambridge-cares/postgis:15-3.4-3.4.1-extra-bundled-SNAPSHOT
3+
image: ghcr.io/cambridge-cares/cambridge-cares/postgis:pgrouting-extra-15-3.5-3.8.0-3dcitydb
44
build: .

0 commit comments

Comments
 (0)