Skip to content
Snippets Groups Projects
Commit e03b9034 authored by Emmanuel Bruno's avatar Emmanuel Bruno
Browse files

important refactoring.

parent 0d7ae091
No related branches found
No related tags found
No related merge requests found
FROM jupyter/scipy-notebook:2021-10-20
USER root
RUN apt-get update --yes && apt-get install --yes --no-install-recommends \
bash \
curl \
......@@ -70,33 +71,27 @@ COPY code-server/icons $HOME/.jupyter/icons
RUN [[ ! -f /home/jovyan/.jupyter/jupyter_config.py ]] && touch /home/jovyan/.jupyter/jupyter_config.py ; \
cat /tmp/jupyter_codeserver_config.py >> /home/jovyan/.jupyter/jupyter_config.py
RUN echo 'for dir in /home/jovyan/work/.ssh; do \n' \
'if [ ! -f $dir ]; then \n' \
'echo "Creating $dir"\n' \
'mkdir -p $dir\n' \
'chmod 700 $dir\n' \
'fi\n' \
'done'>> /etc/skel/.bashrc && \
touch /home/jovyan/work/.gitconfig
# INSTALL NB GRADER FIXE NEEDED
#COPY nbgrader_config.py /tmp/nbgrader_config.py
#RUN python3 -m pip install git+https://github.com/jupyter/nbgrader.git@5a81fd5 && \
# jupyter nbextension install --symlink --sys-prefix --py nbgrader && \
# jupyter nbextension enable --sys-prefix --py nbgrader && \
# jupyter serverextension enable --sys-prefix --py nbgrader && \
# python3 -m pip install ngshare_exchange && \
# cat /tmp/nbgrader_config.py >> /etc/jupyter/nbgrader_config.py && \
# echo -e "\e[93m**** Clean up ****\e[38;5;241m" && \
# npm cache clean --force && \
# mamba clean --all -f -y && \
# jupyter lab clean && \
# rm -rf "/home/${NB_USER}/.cache/yarn" && \
# fix-permissions "$CONDA_DIR" && \
# fix-permissions "/home/$NB_USER"
COPY nbgrader_config.py /tmp/nbgrader_config.py
RUN python3 -m pip install git+https://github.com/jupyter/nbgrader.git@5a81fd5 && \
jupyter nbextension install --symlink --sys-prefix --py nbgrader && \
jupyter nbextension enable --sys-prefix --py nbgrader && \
jupyter serverextension enable --sys-prefix --py nbgrader && \
python3 -m pip install ngshare_exchange && \
cat /tmp/nbgrader_config.py >> /etc/jupyter/nbgrader_config.py && \
echo -e "\e[93m**** Clean up ****\e[38;5;241m" && \
npm cache clean --force && \
mamba clean --all -f -y && \
jupyter lab clean && \
rm -rf "/home/${NB_USER}/.cache/yarn" && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER"
USER $NB_USER
#Adds git and ssh sub directories in works
COPY create_work_subdirs.sh /usr/local/bin/before-notebook.d/
ENV NEEDED_WORK_DIRS .ssh
ENV NEEDED_WORK_FILES .gitconfig
RUN echo -e "\e[93m***** Moves user environment to work subdirectory ****\e[38;5;241m" && \
ln -s work/.gitconfig .gitconfig && \
mkdir work/.ssh && ln -s work/.ssh .ssh
USER $NB_USER
WORKDIR "${HOME}/work"
#!/bin/bash
for subdir in $NEEDED_WORK_DIRS; do
dir=/home/jovyan/work/$subdir
ln -s $dir /home/jovyan/$subdir
if [ ! -f $dir ]; then
echo Creating $dir
mkdir -p $dir
chmod 700 $dir
fi
done
for subfile in $NEEDED_WORK_FILES; do
file=/home/jovyan/work/$subfile
ln -s $file /home/jovyan/$subfile
if [ ! -f $file ]; then
echo Creating $file
touch $file
chmod 700 $dir
fi
done
\ No newline at end of file
#!/usr/bin/env bash
WORKDIR=$HOME/JUPYTER_WORK_DIR
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. ${DIR}/env.sh
docker run --rm \
--name ${PWD##*/} \
--volume $PWD/work:/home/jovyan/work \
--volume $WORKDIR:/home/jovyan/work \
--publish 8888:8888 \
--env NB_UID=$UID \
--env JUPYTER_ENABLE_LAB=yes \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment