services:
  train:
    build:
      context: .
      dockerfile: Dockerfile
      target: base
    volumes:
      - .:/workspace
      - ./data:/workspace/data
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    command: make train
    environment:
      - CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-0}
      - WANDB_API_KEY=${WANDB_API_KEY:-}

  test:
    build:
      context: .
      dockerfile: Dockerfile
      target: cpu-only
    volumes:
      - .:/workspace
    command: make check

  data-gen:
    build:
      context: .
      dockerfile: Dockerfile
      target: base
    volumes:
      - .:/workspace
      - ./data:/workspace/data
    command: make data-gen
