|
| 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"] |
0 commit comments