Merge pull request #272 from abhineetgupta/docker_ag

added database initialization script to dockerfile
This commit is contained in:
Paul Blottiere 2020-06-21 23:37:16 +02:00 committed by GitHub
commit 6e135c93bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

2
.gitignore vendored
View File

@ -26,3 +26,5 @@ pgsql/pc_pgsql.bc
venv
doc/build
doc/__pycache__/
**/.DS_Store

View File

@ -45,3 +45,6 @@ RUN apt-get update \
zlib1g-dev \
postgresql-server-dev-all \
libxml2-dev
RUN mkdir -p /docker-entrypoint-initdb.d
COPY ./initdb-pgpointcloud.sh /docker-entrypoint-initdb.d/10_pgpointcloud.sh

View File

@ -0,0 +1,26 @@
#!/bin/sh
##### Script based on initialization script from postgis-docker #####
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 and POINTCLOUD extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
CREATE EXTENSION IF NOT EXISTS pointcloud;
CREATE EXTENSION IF NOT EXISTS pointcloud_postgis;
EOSQL
done