# PostgreSQL + the API. Not run while writing the course (Docker was not available); see README.
services:
  db:
    image: postgres:17
    environment:
      POSTGRES_USER: orders
      POSTGRES_PASSWORD: orders          # local development only
      POSTGRES_DB: orders
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U orders"]
      interval: 2s
      retries: 30
    ports: ["5432:5432"]

  api:
    build: .
    depends_on:
      db: {condition: service_healthy}
    environment:
      ORDERS_ENVIRONMENT: dev
      ORDERS_DATABASE_URL: postgresql+asyncpg://orders:orders@db:5432/orders
      ORDERS_JWT_SECRET: ${ORDERS_JWT_SECRET:?set ORDERS_JWT_SECRET in your shell or .env}
    ports: ["8000:8000"]
    stop_grace_period: 30s
