# =============================================================================
# jasonwoltje.com — local dev Postgres
# =============================================================================
# Brings up just Postgres for local `pnpm dev`. The Next app runs on the host
# via `pnpm dev` (not in-container) for fast iteration.
#
#   docker compose up -d        # start Postgres
#   pnpm dev                    # run Next + Payload on host
# =============================================================================

services:
  postgres:
    image: postgres:17-alpine
    environment:
      POSTGRES_DB: ${PAYLOAD_POSTGRES_DB:-payload}
      POSTGRES_USER: ${PAYLOAD_POSTGRES_USER:-payload}
      POSTGRES_PASSWORD: ${PAYLOAD_POSTGRES_PASSWORD:-payload}
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres-data:
