name: detections-e2e

services:
  mock-loader:
    build: ./mocks/loader
    volumes:
      - ./fixtures:/models
    networks:
      - e2e-net

  mock-annotations:
    build: ./mocks/annotations
    networks:
      - e2e-net

  detections:
    profiles:
      - cpu
    build:
      context: ..
      dockerfile: Dockerfile
    depends_on:
      - mock-loader
      - mock-annotations
    environment:
      LOADER_URL: http://mock-loader:8080
      ANNOTATIONS_URL: http://mock-annotations:8081
      JWT_SECRET: test-secret-e2e-only
    volumes:
      - ./fixtures/classes.json:/app/classes.json
      - ./fixtures:/media
      - ./logs:/app/Logs
    shm_size: 512m
    mem_limit: 4g
    networks:
      - e2e-net

  detections-gpu:
    profiles:
      - gpu
    build:
      context: ..
      dockerfile: Dockerfile.gpu
    runtime: nvidia
    depends_on:
      - mock-loader
      - mock-annotations
    environment:
      LOADER_URL: http://mock-loader:8080
      ANNOTATIONS_URL: http://mock-annotations:8081
      JWT_SECRET: test-secret-e2e-only
    volumes:
      - ./fixtures/classes.json:/app/classes.json
      - ./fixtures:/media
      - ./logs:/app/Logs
    networks:
      e2e-net:
        aliases:
          - detections

  detections-jetson:
    profiles:
      - jetson
    build:
      context: ..
      dockerfile: Dockerfile.jetson
    runtime: nvidia
    depends_on:
      - mock-loader
      - mock-annotations
    environment:
      LOADER_URL: http://mock-loader:8080
      ANNOTATIONS_URL: http://mock-annotations:8081
      JWT_SECRET: test-secret-e2e-only
      CLASSES_JSON_PATH: /app/classes.json
    volumes:
      - ./fixtures/classes.json:/app/classes.json:ro
      - ./fixtures:/media:ro
      - ./logs:/app/Logs
    shm_size: 512m
    networks:
      e2e-net:
        aliases:
          - detections

  e2e-runner:
    profiles:
      - cpu
      - gpu
      - jetson
    build: .
    depends_on:
      - mock-loader
      - mock-annotations
    environment:
      JWT_SECRET: test-secret-e2e-only
    volumes:
      - ./fixtures:/media
      - ./results:/results
    networks:
      - e2e-net
    command: ["pytest", "--csv=/results/report.csv", "-v"]

networks:
  e2e-net:
    driver: bridge
