# Base image
FROM nvidia/cuda:12.9.1-devel-ubuntu24.04

# Base packages
ENV DEBIAN_FRONTEND=noninteractive \
    PIP_NO_CACHE_DIR=1 \
    TZ=Europe/Gothenburg

# OS deps (graphviz+pandoc). Use --no-install-recommends and clean the lists.
RUN echo python3 --version
RUN \
  apt-get update && \
  apt-get install -y --no-install-recommends \
    git \
    graphviz \
    pandoc \
    python3-pip \
    python3-dev \
    python3.12-venv \
    wget \
    zip \
    unzip && \
  rm -rf /var/lib/apt/lists/*

# Setup venv - avoid using numpy and scipy from system python
RUN python3 -m venv /venv
ENV PATH=/venv/bin:$PATH

# One layer, no cache kept
RUN pip3 install --no-cache-dir --break-system-packages \
    build \
    coverage \
    flake8 \
    flake8-quotes \
    pytest \
    setuptools \
    setuptools_scm \
    twine \
    xdoctest \
    \
    sphinx \
    sphinx_autodoc_typehints \
    pydata-sphinx-theme \
    sphinx_sitemap \
    "sphinxcontrib-bibtex>=2.6" \
    sphinx-design \
    nbsphinx \
    nbmake \
    \
    ase \
    "numpy<=2.3" \
    pandas \
    pybind11 \
    scikit-learn \
    tqdm \
    torch \
    \
    euphonic \
    hiphive \
    matplotlib \
    phonopy \
    seekpath \
    git+https://github.com/pace-neutrons/resins.git \
    git+https://gitlab.com/materials-modeling/dynasor.git

# Install GPUMD
RUN \
  git clone https://github.com/brucefan1983/GPUMD.git && \
  cd GPUMD && \
  git checkout v5.5 && \
  git checkout da61b818e1552649fcf7d22aa9e6a50008c841ae && \
  cd src && \
  make CFLAGS="-std=c++14 -O3 -arch=sm_80 -DDEBUG" -j4 && \
  mv gpumd nep /usr/local/bin/ && \
  cd ../.. && \
  rm -fr GPUMD

CMD ["/bin/bash"]
