# Polleo Demand — local Postgres for development.
#
# The Streamlit app (and eventually FastAPI + React) still runs on the
# host. Only the database lives in Docker. Bring it up with:
#
#     docker compose up -d
#
# Then initialise the schema:
#
#     python db/init_db.py
#
# Data persists in the `pgdata` named volume across container restarts.

services:
  polleo_db:
    image: postgres:16
    container_name: polleo_db
    restart: unless-stopped
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: polleo_demand
      POSTGRES_USER: polleo
      POSTGRES_PASSWORD: polleo_dev
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U polleo -d polleo_demand"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  pgdata:
