version: "3.9"

services:
  postgres:
    image: pgvector/pgvector:pg15
    env_file: .env
    environment:
      POSTGRES_DB: evenage
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    env_file: .env
    ports:
      - "6379:6379"

  minio:
    image: minio/minio
    env_file: .env
    environment:
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin123
    command: server /data --console-address ":9001"
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - minio_data:/data

  jaeger:
    image: jaegertracing/all-in-one:latest
    env_file: .env
    ports:
      - "16686:16686"
      - "4318:4318"

  prometheus:
    image: prom/prometheus:latest
    env_file: .env
    ports:
      - "9090:9090"
    volumes:
      - ./docker/prometheus.yml:/etc/prometheus/prometheus.yml

  dashboard:
    image: nishantgupt786/dashboard:latest
    env_file: .env
    ports:
      - "5173:5173"
    environment:
      VITE_API_URL: http://api:8000
      VITE_DASH_USERS: ${EVENAGE_DASH_USERS:-admin:admin}
    depends_on:
      - api
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5173/"]
      interval: 30s
      timeout: 3s
      start_period: 5s
      retries: 3

  api:
    build: .
    command: python -m evenage.api.main
    env_file: .env
    ports:
      - "8000:8000"
    environment:
      DATABASE_URL: postgresql://postgres:postgres@postgres:5432/evenage
      REDIS_URL: redis://redis:6379
      MINIO_ENDPOINT: minio:9000
      OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318
    depends_on:
      - postgres
      - redis
      - minio
      - jaeger
    volumes:
      - .:/app

volumes:
  postgres_data:
  minio_data:
