Add postgis

This commit is contained in:
ManUtopiK 2022-10-20 23:07:28 +02:00
parent aa7262d8c6
commit 3b341e8a97
3 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,5 @@
FROM postgres:14.5-bullseye
RUN apt-get update && apt-get install -y postgresql-14-postgis-3
CMD ["/usr/local/bin/docker-entrypoint.sh","postgres"]

View File

@ -1,6 +1,10 @@
#!/bin/bash
set -e;
# Add postgis
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE EXTENSION postgis;
EOSQL
if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL

View File

@ -1,7 +1,9 @@
services:
postgres:
container_name: $APP_NAME-postgres
image: postgres:14
build:
context: .
dockerfile: Dockerfile
restart: always
environment:
- POSTGRES_DB=${POSTGRES_DB:-$APP_NAME}