Skip to content

Commit

Permalink
Merge pull request #269 from BaseAdresseNationale/antoineludeau/add-p…
Browse files Browse the repository at this point in the history
…ostgis-into-postgres-docker-image

Added postgis plugin into postgres docker image for local development
  • Loading branch information
antoineludeau authored Oct 4, 2023
2 parents cbd8dd8 + c8e7fb2 commit 1239df4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ services:
volumes:
- db-mongo:/data/db
db-postgres:
image: postgres:15-alpine
build:
dockerfile: docker-resources/postgres/Dockerfile.dev
ports:
- "${POSTGRES_PORT:-5432}:5432"
environment:
Expand Down
8 changes: 8 additions & 0 deletions docker-resources/postgres/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the official PostgreSQL image as the base image
FROM postgres:15

# Install PostGIS extension
RUN apt-get update && apt-get install -y postgresql-15-postgis-3

# Copy a script to activate PostGIS
COPY docker-resources/postgres/init-postgis.sh /docker-entrypoint-initdb.d
5 changes: 5 additions & 0 deletions docker-resources/postgres/init-postgis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e

echo "Activating PostGIS extension..."
psql -U $POSTGRES_USER -d $POSTGRES_DB -c "CREATE EXTENSION postgis;"

0 comments on commit 1239df4

Please sign in to comment.