services:
  nalu-api:
    build:
      context: .
      dockerfile: Dockerfile
    image: nalu-api:latest
    container_name: nalu-api
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ConnectionStrings__MongoDB=${MONGODB_CONNECTION_STRING}
      - Groq__ApiKey=${GROQ_API_KEY}
      - OAuth__Google__ClientId=${GOOGLE_CLIENT_ID}
      - OAuth__Google__ClientSecret=${GOOGLE_CLIENT_SECRET}
      - OAuth__Microsoft__ClientId=${MICROSOFT_CLIENT_ID}
      - OAuth__Microsoft__ClientSecret=${MICROSOFT_CLIENT_SECRET}
    depends_on:
      - mongo
    networks:
      - nalu-net
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 15s

  mongo:
    image: mongo:7
    container_name: nalu-mongo
    restart: unless-stopped
    ports:
      - "27017:27017"
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER:-admin}
      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD}
      - MONGO_INITDB_DATABASE=naluai
    volumes:
      - mongo-data:/data/db
    networks:
      - nalu-net
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  mongo-data:

networks:
  nalu-net:
    driver: bridge
