# Cooling Fluid 10.0 — reproducibility image (CPU-only / Path B).
#
# Base: ubuntu:22.04 + apt gromacs (CPU-only). Slower than Path A but no NGC login needed.
#
# Target runtime:
#   * `run_all.sh check-only`  — ~5 min (same as GPU variant; no MD re-run).
#   * `run_all.sh md_top5`     — 18-24 hrs on a modern 8-core CPU (5 pairs × 500k steps).
#     (Reduce step count via `--steps 100000` for a faster but higher-SE sanity reproduce.)
#
# Build:   docker build -f Dockerfile.cpu -t cf10:cpu .
# Check:   docker run --rm cf10:cpu
# Full:    docker run --rm -v $PWD/outputs:/workspace/outputs cf10:cpu full

FROM ubuntu:22.04

LABEL org.opencontainers.image.title="cooling-fluid-10 (cpu)"
LABEL org.opencontainers.image.description="CPU-only reproducibility image for Cooling Fluid 10.0"
LABEL org.opencontainers.image.source="https://github.com/nickharris808/cooling-fluid-10"
LABEL org.opencontainers.image.licenses="MIT"

ENV DEBIAN_FRONTEND=noninteractive
ENV CONDA_DIR=/opt/miniconda
ENV PATH=${CONDA_DIR}/bin:${PATH}
ENV GMX_PATH=/usr/bin/gmx

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        wget ca-certificates curl git bash gromacs \
    && rm -rf /var/lib/apt/lists/*

ARG MINICONDA_VERSION=py311_24.7.1-0
RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh -O /tmp/miniconda.sh && \
    bash /tmp/miniconda.sh -b -p ${CONDA_DIR} && \
    rm /tmp/miniconda.sh && \
    conda config --system --set channel_priority strict

WORKDIR /workspace

COPY environment.yml /tmp/environment.yml
RUN conda env create -f /tmp/environment.yml && \
    conda clean -afy

COPY src/ src/
COPY scripts/ scripts/
COPY data/processed/ data/processed/
COPY docs/audit/ docs/audit/
COPY docs/PATENT_RECONCILIATION.md docs/PATENT_RECONCILIATION.md
COPY MASTER_RANKINGS.md MASTER_RANKINGS.md
COPY requirements.txt setup.py ./
COPY run_all.sh run_all.sh
COPY environment.yml ./
RUN chmod +x run_all.sh

SHELL ["conda", "run", "--no-capture-output", "-n", "cooling-fluid-10", "/bin/bash", "-c"]
RUN pip install -e . --no-deps

ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "cooling-fluid-10", "/workspace/run_all.sh"]
CMD ["check-only"]
