Created
May 10, 2020 10:40
-
-
Save saaj/455ac4e9986da06c0b44901d42525dc5 to your computer and use it in GitHub Desktop.
Build JupyterLab Python virtual environment with extensions without installing Nodejs locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
VENV=/home/user/some/path/to/venv/jupyterlab | |
docker build -t jupyterlab-venv --build-arg VENV=$VENV - <<EOF | |
FROM ubuntu:bionic | |
ARG VENV | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
python3 python3-dev python3-pip python3-setuptools python3-venv curl | |
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
RUN apt-get install -y --no-install-recommends nodejs | |
RUN mkdir -p $VENV | |
WORKDIR $VENV | |
RUN chown 1000:1000 $VENV | |
USER 1000:1000 | |
RUN python3.6 -m venv $VENV | |
RUN bin/pip install --no-cache-dir pandas matplotlib jupyter jupyterlab plotly | |
ENV npm_config_cache=/tmp/.npm LANG=C.UTF-8 | |
RUN set -ex; \ | |
bin/jupyter labextension install jupyterlab-chart-editor --no-build; \ | |
bin/jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build; \ | |
bin/jupyter labextension install jupyterlab-plotly --no-build; \ | |
bin/jupyter labextension install plotlywidget --no-build; \ | |
bin/jupyter lab build | |
EOF | |
CONTAINER=$(docker create jupyterlab-venv) | |
docker cp $CONTAINER:$VENV $VENV | |
docker rm -v $CONTAINER | |
docker rmi jupyterlab-venv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment