# Postgres for local dev / small production. Use volumes, backups, and strong passwords.
# For large or high-availability apps, prefer a managed DB (Neon, RDS, etc.).
version: "3.9"

services:
  db:
    image: postgres:15
    container_name: soulsync_postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-soulsync}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-soulsync}
      POSTGRES_DB: ${POSTGRES_DB:-soulsync_db}
    volumes:
      - db_data:/var/lib/postgresql/data
    # Bind to 127.0.0.1 in production so DB is not exposed on the network
    ports:
      - "${POSTGRES_HOST:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"

volumes:
  db_data:
