First commit

This commit is contained in:
2025-09-16 11:55:33 +02:00
parent 7e03981ca1
commit 53e4512274
5 changed files with 43 additions and 0 deletions

12
docker/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
FROM reg.cadoles.com/dh/postgis/postgis:16-3.5-alpine
# Vous pouvez ajouter ici d'autres commandes, par exemple pour installer des paquets supplémentaires
RUN apk update && apk upgrade --no-cache
RUN apk add --no-cache gdal gdal-tools gdal-driver-PG
# Exposer le port par défaut de PostgreSQL
EXPOSE 5432
COPY scripts/init-db.sh /docker-entrypoint-initdb.d/init-db.sh
COPY data/RAF20_lambert93.tiff /opt/RAF20_lambert93.tiff
RUN chmod +x /docker-entrypoint-initdb.d/init-db.sh

15
docker/compose.yaml Normal file
View File

@@ -0,0 +1,15 @@
services:
postgis:
image: realz
container_name: postgis_initialized
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB} # Base de données pour l'administration, pas celle de l'app
ports:
- "5433:5432"
volumes:
- postgis_data:/var/lib/postgresql/data
volumes:
postgis_data:

Binary file not shown.

15
docker/scripts/init-db.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
# init-db.sh
# Arrête le script si une commande échoue
set -e
echo "Enabling postgis_raster"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
-- Activation de l'extension pour le raster
CREATE EXTENSION IF NOT EXISTS postgis_raster;
EOSQL
echo "Init database data with RGF93"
raster2pgsql -s RGF93 -I -C -M /opt/RAF20_lambert93.tiff -F -t 100x100 public.raf20lamber93 | psql -U ${POSTGRES_USER} -d ${POSTGRES_DB}
exit $?