version: '3.8'

services:
  # PostgreSQL Database
  postgres:
    image: postgres:15-alpine
    container_name: cors-di-email-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${DB_USER:-postgres}
      POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
      POSTGRES_DB: ${DB_NAME:-cors_di_app}
    ports:
      - "${DB_PORT:-5432}:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./infrastructure/db/init.sql:/docker-entrypoint-initdb.d/init.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Node.js Application (opcionális - ha konténerben is futtatod)
  # app:
  #   build: .
  #   container_name: cors-di-email-app
  #   restart: unless-stopped
  #   ports:
  #     - "${PORT:-3000}:3000"
  #   environment:
  #     - NODE_ENV=development
  #     - DB_HOST=postgres
  #   depends_on:
  #     postgres:
  #       condition: service_healthy
  #   volumes:
  #     - ./src:/app/src
  #   command: npm run dev

volumes:
  postgres_data:
    driver: local
