Skip to content

Commit

Permalink
update and optimize docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej Dundovic committed Jan 12, 2024
1 parent b9fb4ba commit 26f6507
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
42 changes: 34 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) HERMES Development Team.
# Distributed under the terms of the GPLv3.
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/scipy-notebook
FROM $BASE_CONTAINER
ARG OWNER=cosmicrays
ARG BUILD_CONTAINER=$REGISTRY/jupyter/docker-stacks-foundation
ARG RUNNER_CONTAINER=$REGISTRY/jupyter/scipy-notebook
FROM $BUILD_CONTAINER as builder

LABEL maintainer="HERMES Developers <[email protected]>"

Expand All @@ -12,19 +13,23 @@ USER root
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
build-essential \
pkg-config \
cmake \
git \
doxygen \
graphviz \
libgsl-dev \
libfftw3-dev \
libcfitsio-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER ${NB_UID}

# Install Python 3 packages
# Install Python packages
RUN mamba install --yes \
'conda-forge::sphinx' \
'healpy' && \
'h5py' \
'conda-forge::zlib' \
'conda-forge::sphinx' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
Expand All @@ -45,8 +50,29 @@ RUN mkdir build-container && \
-DENABLE_TESTING=On .. && \
make -j && \
make install && \
git clone --depth 1 --branch master --no-checkout https://github.com/cosmicrays/hermes-examples.git && \
cp -r hermes-examples/jupyter /home/${NB_USER}/hermes-examples && \
git clone --depth 1 --branch master https://github.com/cosmicrays/hermes-examples.git && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

FROM $RUNNER_CONTAINER as runner

USER root

RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
libgsl27 \
libfftw3-3 \
libcfitsio9 && \
apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=builder ${CONDA_DIR} ${CONDA_DIR}
COPY --from=builder /tmp/hermes/build-container/hermes-examples/jupyter /home/${NB_USER}/hermes-examples

# Install Python packages
RUN mamba install --yes \
'conda-forge::astropy' \
'conda-forge::healpy' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

Expand Down
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ docker run --name jupyter -it --rm -p 8888:8888 -v $HOME/jupyter-work:/home/jovy

where `$HOME/jupyter-work` is any directory on the host in which notebooks and files can be stored permanently, after the container is stopped and removed. It is linked to the `work` folder within the container.


Jupyter can be accessed through a web browser following a link given in the output of the previous command (such as `http://127.0.0.1:8888/lab?token=b680...`).

0 comments on commit 26f6507

Please sign in to comment.