|
ARG TARGET_ARCH=amd64 |
|
ARG ROOT_VERSION=6.32.02 |
|
ARG ROOT_PRIV=root |
|
|
|
################################################################################ |
|
|
|
FROM rootproject/root:$ROOT_VERSION-ubuntu22.04 AS base-amd64 |
|
|
|
################################################################################ |
|
|
|
FROM ubuntu:22.04 AS base-arm64v8 |
|
|
|
RUN echo "This Dockerfile does not yet support arm64v8" >&2; exit 1 |
|
|
|
################################################################################ |
|
|
|
# hadolint ignore=DL3006 |
|
FROM base-$TARGET_ARCH AS base |
|
|
|
################################################################################ |
|
|
|
FROM base AS mg_builder |
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
|
|
|
# Running mg5_aMC requires: python3-six |
|
# Building pythia8 requires: rsync |
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
python3-six=1.16.* \ |
|
rsync=3.2.* \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
ARG MG5_URL=https://launchpad.net/mg5amcnlo/3.0/3.5.x/+download/MG5_aMC_v3.5.6.tar.gz |
|
|
|
RUN curl -sSL $MG5_URL | tar -xz -C /opt && mv /opt/MG5_* MG5_aMC |
|
RUN echo "n" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
RUN echo "set auto_update 0; save options auto_update" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
|
|
# Install Pythia8 and Delphes |
|
RUN echo "install pythia8" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
RUN grep -q "^pythia8_path" /opt/MG5_aMC/input/mg5_configuration.txt |
|
RUN echo "install Delphes" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
# RUN grep -q "^delphes_path" /opt/MG5_aMC/input/mg5_configuration.txt |
|
|
|
# Turn ON Python2 -> Python3 models conversion |
|
RUN echo "set auto_convert_model T" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
RUN echo "import model EWdim6-full" | python3 /opt/MG5_aMC/bin/mg5_aMC |
|
|
|
################################################################################ |
|
|
|
FROM base AS py_builder |
|
|
|
ARG TORCH_WHL=cpu |
|
|
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
python3-pip=22.* \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
RUN python3 -m pip install --no-cache-dir \ |
|
torch==1.13.1+$TORCH_WHL \ |
|
torchvision==0.14.1+$TORCH_WHL \ |
|
--extra-index-url https://download.pytorch.org/whl/$TORCH_WHL |
|
|
|
ARG MADMINER_VERSION=0.9.6 |
|
|
|
# Running mg5_aMC requires: six |
|
RUN python3 -m pip install --no-cache-dir \ |
|
bqplot==0.12.43 \ |
|
madminer==$MADMINER_VERSION \ |
|
matplotlib==3.2.2 \ |
|
pandas==2.0.3 \ |
|
scikit-learn==1.5.1 \ |
|
scipy==1.10.1 \ |
|
seaborn==0.12.2 \ |
|
six==1.16.0 \ |
|
git+https://github.com/tueda/[email protected] |
|
|
|
# hadolint ignore=DL3059 |
|
RUN python3 -m pip install --no-cache-dir \ |
|
black==24.8.0 \ |
|
isort==5.13.2 \ |
|
jupyterlab-code-formatter==3.0.0 \ |
|
jupyterlab-lsp==5.1.0 \ |
|
jupyterlab==4.2.4 \ |
|
lckr-jupyterlab-variableinspector==3.2.1 \ |
|
python-lsp-server==1.11.0 |
|
|
|
################################################################################ |
|
|
|
FROM base AS runner-base |
|
|
|
COPY --from=mg_builder /opt/MG5_aMC /opt/MG5_aMC |
|
COPY --from=py_builder /usr/local/bin /usr/local/bin |
|
COPY --from=py_builder /usr/local/lib/python3.10 /usr/local/lib/python3.10 |
|
COPY --from=py_builder /usr/local/etc/jupyter /usr/local/etc/jupyter |
|
COPY --from=py_builder /usr/local/share/jupyter /usr/local/share/jupyter |
|
|
|
RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements" |
|
|
|
ENV MG_FOLDER_PATH "/opt/MG5_aMC" |
|
|
|
ENV PATH $MG_FOLDER_PATH/bin:$MG_FOLDER_PATH/HEPTools/lhapdf6_py3/bin:$PATH |
|
ENV LD_LIBRARY_PATH $MG_FOLDER_PATH/HEPTools/lhapdf6_py3/lib:$ROOTSYS/lib |
|
ENV PYTHONPATH $MG_FOLDER_PATH/HEPTools/lhapdf6_py3/local/lib/python3.10/dist-packages:$ROOTSYS/lib |
|
ENV ROOT_INCLUDE_PATH $MG_FOLDER_PATH/Delphes/external |
|
|
|
ARG EXTRA_APT_PACKAGES= |
|
|
|
# hadolint ignore=DL3008 |
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
|
sudo=1.9.* \ |
|
$EXTRA_APT_PACKAGES \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /data |
|
CMD ["/bin/bash"] |
|
|
|
################################################################################ |
|
|
|
FROM runner-base AS runner-rootless |
|
|
|
RUN ln -s /root/.cache /home/user/.cache \ |
|
&& ln -s /root/.config /home/user/.config \ |
|
&& ln -s /root/.ipython /home/user/.ipython \ |
|
&& ln -s /root/.jupyter /home/user/.jupyter \ |
|
&& ln -s /root/.local /home/user/.local |
|
|
|
################################################################################ |
|
|
|
FROM runner-base AS runner-root |
|
|
|
RUN useradd -m user \ |
|
&& echo 'user ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers \ |
|
&& usermod -aG sudo user \ |
|
&& ln -s /data/.cache /home/user/.cache \ |
|
&& ln -s /data/.config /home/user/.config \ |
|
&& ln -s /data/.ipython /home/user/.ipython \ |
|
&& ln -s /data/.jupyter /home/user/.jupyter \ |
|
&& ln -s /data/.local /home/user/.local \ |
|
&& chown -h user:user /home/user/.cache /home/user/.config /home/user/.ipython /home/user/.jupyter /home/user/.local |
|
|
|
COPY docker-entrypoint.sh / |
|
ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"] |
|
|
|
################################################################################ |
|
|
|
# hadolint ignore=DL3006 |
|
FROM runner-$ROOT_PRIV AS runner |