Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.

Commit f006aa0

Browse files
committed
feat: postgres/12
1 parent ce40c6c commit f006aa0

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

12/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM postgres:12
2+
MAINTAINER sushantdhiman "[email protected]"
3+
4+
ENV POSTGIS_MAJOR 3
5+
ENV POSTGIS_VERSION 3.0.0+dfsg-2~exp1.pgdg100+1
6+
7+
RUN apt-get update \
8+
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
9+
&& apt-get install -y --no-install-recommends \
10+
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
11+
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
12+
postgis=$POSTGIS_VERSION \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
16+
COPY ./init-sequelize-db.sh /docker-entrypoint-initdb.d/postgis.sh
17+
COPY ./update-sequelize-db.sh /usr/local/bin/update-sequelize-db.sh

12/init-sequelize-db.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
for DB in "$POSTGRES_DB"; do
9+
echo "Loading Sequelize extensions into $DB"
10+
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
11+
CREATE EXTENSION IF NOT EXISTS postgis;
12+
CREATE EXTENSION IF NOT EXISTS btree_gist;
13+
CREATE EXTENSION IF NOT EXISTS hstore;
14+
CREATE EXTENSION IF NOT EXISTS citext;
15+
EOSQL
16+
done

12/update-sequelize-db.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
POSTGIS_VERSION="${POSTGIS_VERSION%%+*}"
9+
10+
for DB in "$POSTGRES_DB" "${@}"; do
11+
echo "Updating Sequelize extensions '$DB' to $POSTGIS_VERSION"
12+
psql --dbname="$DB" -c "
13+
-- Upgrade PostGIS (includes raster)
14+
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION';
15+
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION';
16+
"
17+
done

0 commit comments

Comments
 (0)