-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fd82c2
commit 3700e72
Showing
4 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
FROM postgres:13 | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
FROM postgres:16-bullseye | ||
|
||
|
||
ENV PG_MAJOR 16 | ||
ENV POSTGIS_MAJOR 3 | ||
ENV POSTGIS_VERSION 3.4.3+dfsg-2.pgdg110+1 | ||
|
||
######################################################## | ||
# Install PostGIS | ||
######################################################## | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
postgresql-13-postgis-3 \ | ||
postgresql-13-postgis-3-scripts \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt-get clean \ | ||
&& rm -rf var/cache/apt/archives/* \ | ||
&& mkdir -p "/docker-entrypoint-initdb.d" \ | ||
&& echo "CREATE EXTENSION IF NOT EXISTS postgis;" > /docker-entrypoint-initdb.d/postgis_o125.sql | ||
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ | ||
&& apt-get install -y --no-install-recommends \ | ||
# ca-certificates: for accessing remote raster files; | ||
# fix: https://github.com/postgis/docker-postgis/issues/307 | ||
ca-certificates \ | ||
\ | ||
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ | ||
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ | ||
&& 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Perform all actions as $POSTGRES_USER | ||
export PGUSER="$POSTGRES_USER" | ||
|
||
# Create the 'template_postgis' template db | ||
"${psql[@]}" <<- 'EOSQL' | ||
CREATE DATABASE template_postgis IS_TEMPLATE true; | ||
EOSQL | ||
|
||
# Load PostGIS into both template_database and $POSTGRES_DB | ||
for DB in template_postgis "$POSTGRES_DB"; do | ||
echo "Loading PostGIS extensions into $DB" | ||
"${psql[@]}" --dbname="$DB" <<-'EOSQL' | ||
CREATE EXTENSION IF NOT EXISTS postgis; | ||
CREATE EXTENSION IF NOT EXISTS postgis_topology; | ||
-- Reconnect to update pg_setting.resetval | ||
-- See https://github.com/postgis/docker-postgis/issues/288 | ||
\c | ||
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; | ||
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; | ||
EOSQL | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Perform all actions as $POSTGRES_USER | ||
export PGUSER="$POSTGRES_USER" | ||
|
||
POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" | ||
|
||
# Load PostGIS into both template_database and $POSTGRES_DB | ||
for DB in template_postgis "$POSTGRES_DB" "${@}"; do | ||
echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" | ||
psql --dbname="$DB" -c " | ||
-- Upgrade PostGIS (includes raster) | ||
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; | ||
-- Upgrade Topology | ||
CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; | ||
-- Install Tiger dependencies in case not already installed | ||
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; | ||
-- Upgrade US Tiger Geocoder | ||
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; | ||
" | ||
done |