-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
72 lines (61 loc) · 2.51 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# VERSION: 1.0
# DESCRIPTION: Dockerized PyNucleus build
# AUTHOR: Christian Glusa
# Base docker image
FROM debian:testing
LABEL maintainer Christian Glusa
# install packages needed for build
RUN sed -i 's/Components: main/Components: main contrib non-free/' /etc/apt/sources.list.d/debian.sources \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
gcc g++ make gfortran \
libssl-dev ca-certificates \
ccache \
git less nano \
libopenblas0-serial \
libmetis-dev libparmetis-dev \
hdf5-tools \
libsuitesparse-dev \
libarpack2-dev \
mpi-default-bin mpi-default-dev \
python3 python3-dev python-is-python3 python3-pip \
python3-numpy python3-scipy python3-matplotlib python3-mpi4py cython3 python3-yaml python3-h5py python3-tk jupyter-notebook python3-meshio python3-gmsh \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# allow running MPI as root in the container
# bind MPI ranks to hwthreads
ENV OMPI_MCA_hwloc_base_binding_policy=hwthread \
MPIEXEC_FLAGS=--allow-run-as-root \
OMPI_ALLOW_RUN_AS_ROOT=1 \
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
PIP_BREAK_SYSTEM_PACKAGES=1
COPY . /pynucleus
WORKDIR /pynucleus
ARG PYNUCLEUS_BUILD_PARALLELISM=1
# Install dependencies
# RUN --mount=type=cache,target=/root/.ccache --mount=type=cache,target=/root/.cache/pip \
RUN \
make prereq PIP_FLAGS=" --break-system-packages" \
&& make prereq-extra PIP_FLAGS=" --break-system-packages"
# Build PyNucleus
# RUN --mount=type=cache,target=/root/.ccache --mount=type=cache,target=/root/.cache/pip \
RUN \
make install PIP_INSTALL_FLAGS=" --break-system-packages" \
&& find . -type f -name '*.c' -exec rm {} + \
&& find . -type f -name '*.cpp' -exec rm {} + \
&& rm -rf build packageTools/build base/build metisCy/build fem/build multilevelSolver/build nl/build \
&& ccache -s
# Generate documentation and examples
RUN make docs \
&& rm examples/test.hdf5
# Set up greeting, settings
RUN \
echo '[ ! -z "$TERM" -a -r /pynucleus/README.container.rst ] && printf "\e[32m" && cat /pynucleus/README.container.rst && printf "\e[0m"' >> /etc/bash.bashrc \
&& echo "alias ls='ls --color=auto -FN'" >> /etc/bash.bashrc \
&& echo "set completion-ignore-case On" >> /etc/inputrc
# Set up entrypoint with jupyter notebook
COPY entrypoint.sh /usr/local/bin/
ENTRYPOINT ["entrypoint.sh"]
WORKDIR /root
EXPOSE 8889