services:
  app:
    image: mcr.microsoft.com/devcontainers/typescript-node:22
    volumes:
      - ..:/workspace:cached
      - pnpm-store:/root/.local/share/pnpm/store
    command: sleep infinity
    environment:
      DATABASE_URL: postgresql://postgres:postgres@db:5432/askqien
      NEXTAUTH_URL: http://localhost:3000
    depends_on:
      db:
        condition: service_healthy

  mailpit:
    image: axllent/mailpit:latest
    restart: unless-stopped
    ports:
      - "1025:1025"
      - "8025:8025"

  db:
    image: pgvector/pgvector:pg16
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: askqien
      POSTGRES_USER: postgres
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d askqien"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  pgdata:
  pnpm-store:
