# Pinned artifact-evaluation image.
#
# Host-only evaluation (allocator, planner, calibrator, baselines, figures)
# does not need a GPU. The same image builds the CUDA library when nvidia-smi
# is present, so a reviewer with a GPU can run experiments/run_gpu.sh without
# changing the pin.
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=UTC \
    LANG=C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        cmake \
        ninja-build \
        python3 \
        python3-pip \
        python3-venv \
        python3-dev \
        git \
        ca-certificates \
        pkg-config \
    && rm -rf /var/lib/apt/lists/*

# Analysis pins live in the repository. Installing them at image-build time
# keeps `python analysis/make_all.py` offline after the first pull.
WORKDIR /opt/opencudalab
COPY analysis/requirements.txt /tmp/requirements.txt
RUN python3 -m pip install --break-system-packages -r /tmp/requirements.txt

COPY . /opt/opencudalab
RUN cmake -S . -B build -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DOCL_ENABLE_CUDA=OFF \
        -DOCL_ENABLE_TESTS=ON \
    && cmake --build build -j \
    && ctest --test-dir build --output-on-failure

WORKDIR /opt/opencudalab
ENTRYPOINT ["bash", "docker/entrypoint.sh"]
