# duelbench in a container.
#
#   docker build -t duelbench .                                   # CPU PyTorch (no CUDA download)
#   docker build -t duelbench --build-arg TORCH_INDEX=https://download.pytorch.org/whl/cu128 .
#
#   docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v "$PWD/runs:/work/runs" \
#       -v duelbench-cache:/cache duelbench run -t gsm8k -m oracle -m random --limit 20
#
# The code sandbox starts its containers through the host's Docker daemon: mounting the socket
# gives this container control of Docker, so only run images you built yourself.
FROM python:3.12-slim

COPY --from=docker:cli /usr/local/bin/docker /usr/local/bin/docker

ARG TORCH_INDEX=https://download.pytorch.org/whl/cpu
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PYTHONUNBUFFERED=1 \
    DUELBENCH_HOME=/cache/duelbench HF_HOME=/cache/hf HF_HUB_DISABLE_TELEMETRY=1
RUN pip install torch torchvision --index-url "$TORCH_INDEX"

WORKDIR /src
COPY pyproject.toml README.md LICENSE ./
COPY src ./src
RUN pip install -e ".[hf,vision,embeddings,math,anthropic,dev]"
COPY tests ./tests
COPY examples ./examples
COPY docs ./docs
COPY scripts ./scripts
COPY results ./results

WORKDIR /work
ENTRYPOINT ["duel"]
CMD ["--help"]
