Skip to content

Commit 5e2120e

Browse files
feat: Add Debian based Dockerfile
Build struture assumes running docker build from the top level of the repository. e.g. docker build --file docker/Dockerfile --tag madanalysis5/madanalysis5:debug-local . Add .dockerignore
1 parent 65d4239 commit 5e2120e

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github

docker/Dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
ARG BUILDER_IMAGE=python:3.9-slim-bullseye
2+
FROM ${BUILDER_IMAGE} as builder
3+
4+
USER root
5+
WORKDIR /
6+
7+
SHELL [ "/bin/bash", "-c" ]
8+
9+
COPY . /root/madanalysis5
10+
11+
# Set PATH to pickup virtualenv by default
12+
ENV PATH=/usr/local/venv/bin:"${PATH}"
13+
RUN apt-get -qq -y update && \
14+
apt-get -qq -y install --no-install-recommends \
15+
gcc \
16+
g++ \
17+
make \
18+
zlib1g \
19+
bash-completion \
20+
python3-dev \
21+
less \
22+
tree \
23+
wget \
24+
curl \
25+
gnuplot \
26+
git && \
27+
apt-get -y clean && \
28+
apt-get -y autoremove && \
29+
rm -rf /var/lib/apt/lists/* && \
30+
python -m venv /usr/local/venv && \
31+
. /usr/local/venv/bin/activate && \
32+
python -m pip --no-cache-dir install --upgrade pip setuptools wheel && \
33+
python -m pip --no-cache-dir install pip-tools && \
34+
python -m pip list && \
35+
python -m piptools compile \
36+
--generate-hashes \
37+
--output-file /root/madanalysis5/requirements.lock \
38+
/root/madanalysis5/docker/requirements.txt && \
39+
python -m pip --no-cache-dir install --upgrade --requirement /root/madanalysis5/requirements.lock && \
40+
python -m pip list && \
41+
export PATH="$(find / -type d -iname madanalysis5)/bin:${PATH}" && \
42+
python -c 'import multiprocessing; print(multiprocessing.cpu_count())' | ma5 && \
43+
printf '\nexport PATH=/usr/local/venv/bin:"${PATH}"\n' >> /root/.bashrc && \
44+
printf '\nexport PATH='"$(find / -type d -iname madanalysis5)/bin"':"${PATH}"\n' >> /root/.bashrc
45+
46+
# Enable tab completion by uncommenting it from /etc/bash.bashrc
47+
# The relevant lines are those below the phrase "enable bash completion in interactive shells"
48+
RUN export SED_RANGE="$(($(sed -n '\|enable bash completion in interactive shells|=' /etc/bash.bashrc)+1)),$(($(sed -n '\|enable bash completion in interactive shells|=' /etc/bash.bashrc)+7))" && \
49+
sed -i -e "${SED_RANGE}"' s/^#//' /etc/bash.bashrc && \
50+
unset SED_RANGE
51+
52+
# Use C.UTF-8 locale to avoid issues with ASCII encoding
53+
ENV LC_ALL=C.UTF-8
54+
ENV LANG=C.UTF-8
55+
56+
# Default user is root to avoid uid write permission problems with volumes
57+
ENV HOME /root
58+
WORKDIR ${HOME}/data
59+
60+
ENV PATH="${HOME}/.local/bin:${PATH}"
61+
ENV PATH="/root/madanalysis5/bin:${PATH}"
62+
63+
ENTRYPOINT ["/bin/bash", "-l", "-c"]
64+
CMD ["/bin/bash"]

docker/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
six>=1.16.0 # required by ma5
2+
scipy>=1.7.0 # optional for reinterpretation
3+
pyhf>=0.6.3 # optional for reinterpretation
4+
matplotlib>=3.5.0 # optional for histogramming

0 commit comments

Comments
 (0)