version: "3.8"

x-common: &common
  volumes:
    - ${ALGORITHMS_DIR}:/app/algorithms
    - ${RESULTS_DIR}:/app/results
  command: ["sleep", "infinity"]

x-common-gpu: &common-gpu
  runtime: nvidia

services:
  slave:
    build:
      context: .
      dockerfile: slave/Dockerfile
    image: ghcr.io/tig-foundation/tig-monorepo/benchmarker/slave:${VERSION}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ${ALGORITHMS_DIR}:/app/algorithms
      - ${RESULTS_DIR}:/app/results
    environment:
      - VERBOSE=${VERBOSE}
      - SLAVE_NAME=${SLAVE_NAME}
      - MASTER_PORT=${MASTER_PORT}
      - MASTER_IP=${MASTER_IP}
      - TTL=${TTL}
      - NUM_WORKERS=${NUM_WORKERS}

  satisfiability:
    <<: *common
    image: ghcr.io/tig-foundation/tig-monorepo/satisfiability/runtime:${VERSION}
    container_name: satisfiability

  vehicle_routing:
    <<: *common
    image: ghcr.io/tig-foundation/tig-monorepo/vehicle_routing/runtime:${VERSION}
    container_name: vehicle_routing

  knapsack:
    <<: *common
    image: ghcr.io/tig-foundation/tig-monorepo/knapsack/runtime:${VERSION}
    container_name: knapsack

  vector_search:
    <<: [*common, *common-gpu]
    image: ghcr.io/tig-foundation/tig-monorepo/vector_search/runtime:${VERSION}
    container_name: vector_search

  hypergraph:
    <<: [*common, *common-gpu]
    image: ghcr.io/tig-foundation/tig-monorepo/hypergraph/runtime:${VERSION}
    container_name: hypergraph

  neuralnet_optimizer:
    <<: [*common, *common-gpu]
    image: ghcr.io/tig-foundation/tig-monorepo/neuralnet_optimizer/runtime:${VERSION}
    container_name: neuralnet_optimizer