# Docker Compose pour développement local de la base de données uniquement
# Usage: docker compose -f docker-compose.dev.yml up -d

services:
  # Base de données PostgreSQL
  postgres:
    image: postgres:17
    container_name: ptitspas-postgres-standalone
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-admin}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-admin123}
      POSTGRES_DB: ${POSTGRES_DB:-ptitpas_db}
    ports:
      - "5433:5432"
    volumes:
    - ./migrations/01_init.sql:/docker-entrypoint-initdb.d/01_init.sql
    - ./migrations/07_import.sql:/docker-entrypoint-initdb.d/07_import.sql
    - ./bdd/data_test:/bdd/data_test
    - postgres_standalone_data:/var/lib/postgresql/data
    networks:
      - ptitspas_dev

  # Interface d'administration DB
  pgadmin:
    image: dpage/pgadmin4:9.8
    container_name: ptitspas-pgadmin-standalone
    restart: unless-stopped
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@ptits-pas.fr}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin123}
    ports:
      - "8081:80"
    depends_on:
      - postgres
    networks:
      - ptitspas_dev
    volumes:
      - ./pgadmin/servers.json:/pgadmin4/servers.json

volumes:
  postgres_standalone_data:

networks:
  ptitspas_dev:
    driver: bridge
