Skip to content

Commit

Permalink
Merge pull request #5 from casperdcl/jupyterhub_env
Browse files Browse the repository at this point in the history
jupyterhub builds
  • Loading branch information
paskino committed Nov 28, 2023
2 parents 6d057c1 + 987a066 commit 81f8e87
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "jupyterhub/docker-stacks"]
path = jupyterhub/docker-stacks
url = https://github.com/jupyter/docker-stacks
17 changes: 10 additions & 7 deletions jupyterhub/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# syntax=docker/dockerfile:1
ARG BASE_IMAGE=nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
# paskino/jupyter datascience-notebook-cuda11
FROM ${BASE_IMAGE} as base

# Make sure the image has the same libraries as the standard SIRF docker image
# Add to the docker image the appropriate stuff
user root
USER root
COPY --chown=jovyan:users docker/build_essential-ubuntu.sh docker/build_gadgetron-ubuntu.sh docker/build_system-ubuntu.sh docker/install-sirf-exercises-dep.py ./scripts/
RUN bash ./scripts/build_essential-ubuntu.sh &&\
bash ./scripts/build_gadgetron-ubuntu.sh &&\
Expand All @@ -14,10 +15,10 @@ RUN bash ./scripts/build_essential-ubuntu.sh &&\
# https://docs.docker.com/develop/develop-images/multistage-build/#use-an-external-image-as-a-stage
# not documented in https://docs.docker.com/engine/reference/builder/#copy
# FROM --from=nginx:latest /etc/nginx/nginx.conf /nginx.conf
COPY --from=synerbi/sirf:sirf-core /opt/SIRF-SuperBuild/INSTALL/ /opt/SIRF-SuperBuild/INSTALL
COPY --from=synerbi/sirf:sirf-core /opt/SIRF-SuperBuild/sources/SIRF/ /opt/SIRF-SuperBuild/sources/SIRF/
COPY --from=synerbi/sirf:latest --link /opt/SIRF-SuperBuild/INSTALL/ /opt/SIRF-SuperBuild/INSTALL
COPY --from=synerbi/sirf:latest --link /opt/SIRF-SuperBuild/sources/SIRF/ /opt/SIRF-SuperBuild/sources/SIRF/

from base as jup
FROM base AS jup
# remove the SIRF-Exercises and CIL-Demos that get installed by user_service-ubuntu.sh
USER jovyan
ARG NB_USER="jovyan"
Expand All @@ -44,7 +45,7 @@ RUN mamba env update -n base -f docker/requirements.yml &&\
# Switch back to jovyan to avoid accidental container runs as root
# From https://github.com/paskino/SIRF-SuperBuild/blob/301c2274621e4729cadbd2a1705d8c4d9e3b7e50/docker/Dockerfile#L212-L219
# Set environment variables for SIRF
USER jovyan
USER jovyan
COPY docker/.bashrc /home/jovyan
ENV PATH "/opt/conda/bin:/opt/SIRF-SuperBuild/INSTALL/bin:$PATH"
ENV LD_LIBRARY_PATH "/opt/SIRF-SuperBuild/INSTALL/lib:/opt/SIRF-SuperBuild/INSTALL/lib64:$LD_LIBRARY_PATH"
Expand All @@ -55,8 +56,10 @@ ENV SIRF_PATH "/opt/SIRF-SuperBuild/sources/SIRF"
#Suppress output from Gadgetron which gives some problems on notebooks (QUIERO)
ENV GADGETRON_LOG_MASK ""
RUN echo $PATH
USER root
RUN echo "export OMP_NUM_THREADS=\$(python -c 'import multiprocessing as mc; print(mc.cpu_count() // 2)')" > /usr/local/bin/before-notebook.d/omp_num_threads.sh

# switch back to
# switch back to
USER jovyan

#/opt/SIRF-SuperBuild/INSTALL/lib:/opt/SIRF-SuperBuild/INSTALL/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64::/opt/conda/lib
#/opt/SIRF-SuperBuild/INSTALL/lib:/opt/SIRF-SuperBuild/INSTALL/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64::/opt/conda/lib
10 changes: 6 additions & 4 deletions jupyterhub/build_docker_stacks.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# /bin/bash
#!/usr/bin/env bash
set -exuo pipefail

set -ex
pushd ../../docker-stacks/images/docker-stacks-foundation
git submodule update --init --recursive
pushd $(dirname "$0")/docker-stacks/images/docker-stacks-foundation
# docker-stacks-foundations
docker build --build-arg PYTHON_VERSION=3.9 --build-arg ROOT_CONTAINER=nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04 -t paskino/jupyter:docker-stacks-foundation-cuda11-cudnn8-runtime-ubuntu22.04 .
docker build --build-arg PYTHON_VERSION=3.9 --build-arg BASE_CONTAINER=nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04 -t paskino/jupyter:docker-stacks-foundation-cuda11-cudnn8-runtime-ubuntu22.04 .

# base notebook
cd ../base-notebook
Expand All @@ -26,3 +27,4 @@ docker build --build-arg BASE_CONTAINER=paskino/jupyter:scipy-notebook-cuda11-cu

popd

docker build --build-arg BASE_IMAGE=paskino/jupyter:datascience-notebook-cuda11-cudnn8-runtime-ubuntu22.04 -t paskino/jupyter:sirf -f jupyterhub/Dockerfile .
1 change: 1 addition & 0 deletions jupyterhub/docker-stacks
Submodule docker-stacks added at d91bb6

0 comments on commit 81f8e87

Please sign in to comment.