From 67b30b37cbab9a4e1869985045c73d8a4383d3f0 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 9 Oct 2022 21:02:49 -0700 Subject: [PATCH] Added manim module --- jupyter/README.md | 9 +++++++-- jupyter/build/base/Dockerfile | 5 +---- jupyter/build/build.fish | 9 ++++++++- jupyter/build/manim.Dockerfile | 31 ++++++++++++++++++++++++++++++ jupyter/build/pymodules.Dockerfile | 3 ++- 5 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 jupyter/build/manim.Dockerfile diff --git a/jupyter/README.md b/jupyter/README.md index 0ac108c..783294a 100644 --- a/jupyter/README.md +++ b/jupyter/README.md @@ -19,9 +19,14 @@ Change the permissions on the configuration volume (see `docker-compose.yml`) if You may want to add the following lines to `jupyter_notebook_config.py`: -``` +```python c.ServerApp.local_hostnames = ["localhost", "0.0.0.0"] c.ServerApp.token = "a_long_random_string" + +c.TagRemovePreprocessor.enabled = True +c.TagRemovePreprocessor.remove_cell_tags = ("hide_cell",) +c.TagRemovePreprocessor.remove_all_outputs_tags = ("hide_output",) +c.TagRemovePreprocessor.remove_input_tags = ("hide_input",) ``` The first sets `0.0.0.0` to the allowed local hostname list. This prevents a possible "connection reset" when connecting to the docker container. Opens jupyter up to the outside internet, but you should have your inbound ports firewalled off anyway. @@ -29,7 +34,6 @@ The first sets `0.0.0.0` to the allowed local hostname list. This prevents a pos The second line sets a persistent token. If this config value is unset, jupyter will generate a new one on each run, making it hard to make a one-click bookmark. - ## Image contents - jupyterlab, jupyterhub, notebook - latex + pandoc for exporting @@ -42,6 +46,7 @@ The second line sets a persistent token. If this config value is unset, jupyter - numpy - matplotlib - pandas + - manim - Octave - R - Julia diff --git a/jupyter/build/base/Dockerfile b/jupyter/build/base/Dockerfile index a2d39f3..80c2233 100644 --- a/jupyter/build/base/Dockerfile +++ b/jupyter/build/base/Dockerfile @@ -48,10 +48,7 @@ RUN apt-get update --yes && \ # pandoc: convert notebooks to html # texlive-*: for nbconvert pandoc \ - texlive \ - texlive-xetex \ - texlive-fonts-recommended \ - texlive-plain-generic \ + texlive-full \ # Misc dependencies # build-essential: for cython # cm-super, dvipng: for latex labels diff --git a/jupyter/build/build.fish b/jupyter/build/build.fish index 3a50ad9..1365ca4 100755 --- a/jupyter/build/build.fish +++ b/jupyter/build/build.fish @@ -45,20 +45,27 @@ echo "" printf "Building base image...\n" docker build \ --quiet=$is_quiet \ + --build-arg PYTHON_VERSION=3.9 \ -t betalupi/jupyter-inter-0 \ $root_dir/base printf "Done. \n\n" + build_image false octave build_image false r build_image false julia -#build_image false haskell (BROKEN) #build_image false sage (BROKEN) build_image false plugins build_image false pymodules +# Manim will not install under python 3.10. +# 3.9 works (see arguments for base above) +build_image false manim + + + # Rename final image docker image tag betalupi/jupyter-inter-(math $img_idx) git.betalupi.com/mark/jupyter docker image rm betalupi/jupyter-inter-(math $img_idx) diff --git a/jupyter/build/manim.Dockerfile b/jupyter/build/manim.Dockerfile new file mode 100644 index 0000000..d60c153 --- /dev/null +++ b/jupyter/build/manim.Dockerfile @@ -0,0 +1,31 @@ +ARG BASE_CONTAINER=betalupi/jupyter-base +FROM $BASE_CONTAINER +LABEL maintainer="Mark " + +USER root + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends \ + # Manim dependencies + libcairo2-dev \ + libpango1.0-dev \ + ffmpeg \ + dvisvgm \ + && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + + +USER $NB_UID + +# Manim will not install under python 3.10 +# as of 2022-10-09 + +RUN mamba install --yes \ + "manim" \ + && \ + # Cleanup + mamba clean --all -f -y && \ + npm cache clean --force && \ + jupyter lab clean && \ + rm -rf "/home/${NB_USER}/.cache/yarn" && \ + fix-permissions "${CONDA_DIR}" && \ + fix-permissions "/home/${NB_USER}" \ No newline at end of file diff --git a/jupyter/build/pymodules.Dockerfile b/jupyter/build/pymodules.Dockerfile index 936ce0e..82da1dd 100644 --- a/jupyter/build/pymodules.Dockerfile +++ b/jupyter/build/pymodules.Dockerfile @@ -2,7 +2,7 @@ ARG BASE_CONTAINER=betalupi/jupyter-base FROM $BASE_CONTAINER LABEL maintainer="Mark " -USER ${NB_UID} +USER $NB_UID RUN mamba install --yes \ # Python packages @@ -41,6 +41,7 @@ RUN mamba install --yes \ "xlrd" \ "tensorflow" \ "pytest" \ + "ipython" \ && \ # Cleanup mamba clean --all -f -y && \