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

Commit b9fa1be

Browse files
committed
fix: update alpine image
1 parent d97e988 commit b9fa1be

File tree

5 files changed

+54
-4
lines changed

5 files changed

+54
-4
lines changed

9.5-alpine/00-extensions.sql

-3
This file was deleted.

9.5-alpine/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ RUN set -ex \
6060
&& rm -rf /usr/src/postgis \
6161
&& apk del .fetch-deps .build-deps .build-deps-testing
6262

63-
COPY 00-extensions.sql /docker-entrypoint-initdb.d/
63+
COPY init-sequelize-db.sh /docker-entrypoint-initdb.d/
64+
COPY update-sequelize-db.sh /usr/local/bin

9.5-alpine/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+
# Load PostGIS into both template_database and $POSTGRES_DB
9+
for DB in template_postgis "$POSTGRES_DB"; do
10+
echo "Loading PostGIS extensions into $DB"
11+
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
12+
CREATE EXTENSION IF NOT EXISTS postgis;
13+
CREATE EXTENSION IF NOT EXISTS btree_gist;
14+
CREATE EXTENSION IF NOT EXISTS hstore;
15+
EOSQL
16+
done

9.5-alpine/update-sequelize-db.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
# Load PostGIS into both template_database and $POSTGRES_DB
11+
for DB in template_postgis "$POSTGRES_DB" "${@}"; do
12+
echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION"
13+
psql --dbname="$DB" -c "
14+
-- Upgrade PostGIS (includes raster)
15+
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION';
16+
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION';
17+
"
18+
done

Readme.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Sequelize PostGIS
2+
3+
Postgres image for Sequelize with support for essential extensions
4+
5+
## Known Issues / Errors
6+
7+
If you encounter errors due to PostGIS update
8+
9+
```bash
10+
OperationalError: could not access file "$libdir/postgis-X.X"
11+
```
12+
13+
Run
14+
15+
```bash
16+
docker exec postgres-95 update-sequelize-db.sh
17+
```
18+

0 commit comments

Comments
 (0)