@@ -8,10 +8,12 @@ LABEL maintainer Christian Glusa
8
8
9
9
# install packages needed for build
10
10
RUN sed -i 's/Components: main/Components: main contrib non-free/' /etc/apt/sources.list.d/debian.sources \
11
- && apt-get update && \
12
- DEBIAN_FRONTEND=noninteractive apt-get install -y \
11
+ && apt-get update \
12
+ && DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y \
13
+ && DEBIAN_FRONTEND=noninteractive apt-get install -y \
13
14
gcc g++ make gfortran \
14
15
libssl-dev ca-certificates \
16
+ ccache \
15
17
git less nano \
16
18
libopenblas0-serial \
17
19
libmetis-dev libparmetis-dev \
@@ -37,30 +39,31 @@ WORKDIR /pynucleus
37
39
38
40
ARG PYNUCLEUS_BUILD_PARALLELISM=1
39
41
40
- # Build PyNucleus
41
- RUN make prereq PIP_FLAGS="--no-cache-dir --break-system-packages" && \
42
- make prereq-extra PIP_FLAGS="--no-cache-dir --break-system-packages" && \
43
- make install PIP_INSTALL_FLAGS="--no-cache-dir --break-system-packages" && \
44
- make docs && \
45
- find . -type f -name '*.c' -exec rm {} + && \
46
- find . -type f -name '*.cpp' -exec rm {} + && \
47
- rm -rf build packageTools/build base/build metisCy/build fem/build multilevelSolver/build nl/build
42
+ # Install dependencies
43
+ RUN --mount=type=cache,target=/root/.ccache --mount=type=cache,target=/root/.cache/pip \
44
+ make prereq PIP_FLAGS=" --break-system-packages" \
45
+ && make prereq-extra PIP_FLAGS=" --break-system-packages"
48
46
49
- # Set up Jupyter notebooks, greeting, some bash things
50
- RUN python -m pip install --no-cache-dir --break-system-packages ipykernel && \
51
- python -m ipykernel install --name=PyNucleus && \
52
- echo '[ ! -z "$TERM" -a -r /pynucleus/README.container.rst ] && printf "\e [32m" && cat /pynucleus/README.container.rst && printf "\e [0m"' >> /etc/bash.bashrc && \
53
- echo "alias ls='ls --color=auto -FN'" >> /etc/bash.bashrc && \
54
- echo "set completion-ignore-case On" >> /etc/inputrc
47
+ # Build PyNucleus
48
+ RUN --mount=type=cache,target=/root/.ccache --mount=type=cache,target=/root/.cache/pip \
49
+ make install PIP_INSTALL_FLAGS=" --break-system-packages" \
50
+ && find . -type f -name '*.c' -exec rm {} + \
51
+ && find . -type f -name '*.cpp' -exec rm {} + \
52
+ && rm -rf build packageTools/build base/build metisCy/build fem/build multilevelSolver/build nl/build \
53
+ && ccache -s
55
54
56
- WORKDIR /root
55
+ # Generate documentation and examples
56
+ RUN make docs \
57
+ && rm examples/test.hdf5
57
58
58
- # Copy examples and drivers to user home, launch Jupyter notebook server
59
- ENTRYPOINT mkdir -p /root/examples && \
60
- mkdir -p /root/drivers && \
61
- cp -r --update=none /pynucleus/examples/* /root/examples && \
62
- cp -r --update=none /pynucleus/drivers/* /root/drivers && \
63
- jupyter notebook --port=8889 --no-browser --ip=0.0.0.0 --allow-root --NotebookApp.token='' --NotebookApp.password='' --notebook-dir=/root/ --KernelSpecManager.ensure_native_kernel=False --KernelSpecManager.allowed_kernelspecs=pynucleus > /dev/null 2>&1 & \
64
- /bin/bash
59
+ # Set up greeting, settings
60
+ RUN \
61
+ echo '[ ! -z "$TERM" -a -r /pynucleus/README.container.rst ] && printf "\e [32m" && cat /pynucleus/README.container.rst && printf "\e [0m"' >> /etc/bash.bashrc \
62
+ && echo "alias ls='ls --color=auto -FN'" >> /etc/bash.bashrc \
63
+ && echo "set completion-ignore-case On" >> /etc/inputrc
65
64
65
+ # Set up entrypoint with jupyter notebook
66
+ COPY entrypoint.sh /usr/local/bin/
67
+ ENTRYPOINT ["entrypoint.sh" ]
68
+ WORKDIR /root
66
69
EXPOSE 8889
0 commit comments