From 38be7b6c4083c3707515e9c0f6354766ab50f321 Mon Sep 17 00:00:00 2001 From: Don Aldrich Date: Thu, 28 Jul 2022 07:15:51 +0000 Subject: [PATCH] Initial Commit --- .gitignore | 3 ++ Dockerfile | 35 ++++++++++++++++ Taskfile.yml | 24 +++++++++++ requirements.txt | 38 +++++++++++++++++ scripts/pre/startup.sh | 24 +++++++++++ scripts/start/startup.sh | 91 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 215 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Taskfile.yml create mode 100644 requirements.txt create mode 100755 scripts/pre/startup.sh create mode 100755 scripts/start/startup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..972f9c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +home/ +install-tl/ + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..954c493 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM jupyter/scipy-notebook + +USER root + +RUN apt-get update -y && apt-get install -y texlive-fonts-extra \ + # && apt-get autoremove -y && apt-get autoclean -y \ + # && rm -rf \ + # /tmp/* \ + # /var/cache/apt/archives/* \ + # /var/lib/apt/lists/* \ + # /var/tmp/* + +RUN tlmgr update --self && tlmgr install fontawesome5 +# && tlmgr install scheme-full + +USER jovyan + +COPY home/requirements.txt /home/jovyan + +RUN pip install --quiet --no-cache-dir -r /home/jovyan/requirements.txt + +RUN jlpm add --dev \ + bash-language-server \ + dockerfile-language-server-nodejs \ + pyright \ + sql-language-server \ + typescript-language-server \ + unified-language-server \ + vscode-css-languageserver-bin \ + vscode-html-languageserver-bin \ + vscode-json-languageserver-bin \ + yaml-language-server + +RUN conda install --quiet --yes -c conda-forge texlab chktex && \ + conda clean --all -f -y diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..9d19aff --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,24 @@ +version: "3" + +env: + +tasks: + default: + cmds: + - task: build + - task: lint:caddy + - task: deploy:up + - task: image:push + + build: + cmds: + - docker build --pull --load -f Dockerfile --tag donaldrich/jupyterhub:latest . + + lint:scripts: + cmds: + - shellcheck scripts/**/*.sh --format=diff > data/shellcheck.diff + - patch -p1 < data/shellcheck.diff + test:prebuild: + cmds: + # - docker run donaldrich/caddy:latest cat modules.txt + - docker run -v "$PWD/config:/config" donaldrich/jupyterhub:latest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..549797a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,38 @@ + +httpie +parsel +# flatten_json +lxml +openpyxl +ipywidgets +gql + +# nb_black +# bs2json +# papermill +# ploomber +nbdev +black +isort +# selenium + +# scrapy_headless +# scrapy_selenium +# scrapy +# scrapy_splash + +jupyterlab-git +jupyterlab_widgets +jupyterlab_latex +jupyter_console +jupyterlab_widgets +jupyterthemes +jedi-language-server +jupyterlab-lsp + +# https://github.com/jupyterlab/jupyterlab-plugin-playground +jupyterlab-plugin-playground +jupyter_nbextensions_configurator +# jupyterlab-fonts +# +# jupyterlab_proxy_gui diff --git a/scripts/pre/startup.sh b/scripts/pre/startup.sh new file mode 100755 index 0000000..953e19a --- /dev/null +++ b/scripts/pre/startup.sh @@ -0,0 +1,24 @@ +# apt install -qqq textlive +# pip install --upgrade -r /home/jovyan/code/requirements.txt + +# tlmgr update --self && tlmgr install scheme-full + +# install a package into the default (python 3.x) environment and cleanup after the installation +# mamba install --quiet --yes some-package && \ +# mamba clean --all -f -y && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# pip install --quiet --no-cache-dir some-package && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# conda install --quiet --yes some-package && \ +# conda clean --all -f -y && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# apt install -y libxss1 libappindicator1 libindicator7 +# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +# dpkg -i google-chrome*.deb +# apt install -y -f diff --git a/scripts/start/startup.sh b/scripts/start/startup.sh new file mode 100755 index 0000000..c203b24 --- /dev/null +++ b/scripts/start/startup.sh @@ -0,0 +1,91 @@ +#!/bin/sh +chown -R 1000:1000 /home/jovyan +# pip install --no-cache-dir --upgrade -r /home/jovyan/projects/secrets/jupyter/requirements.txt + +# jupyter labextension install jupyterlab_onedarkpro + # jupyterlab-jupytext v1.3.6 enabled OK (python, jupytext) + # jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments) + # @jupyter-widgets/jupyterlab-manager v3.1.0 enabled OK (python, jupyterlab_widgets) + + # jupyter-matplotlib v0.11.1 enabled OK + + # @arbennett/base16-gruvbox-dark v0.1.5 enabled OK + # @jupyterlab/git v0.37.1 enabled OK + # @jupyterlab/latex v3.0.0 enabled OK + # @jupyterlab/plugin-playground v0.4.0 enabled OK + + # @jupyterlab/plugin-playground needs to be included in build + # @jupyterlab/latex needs to be included in build + # @arbennett/base16-gruvbox-dark needs to be included in build +# pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install + +sudo apt update -y && sudo apt install -y texlive-fonts-extra + +tlmgr update --self && tlmgr install fontawesome5 +# && tlmgr install scheme-full + +pip install --quiet --no-cache-dir -r /home/jovyan/requirements.txt + +jlpm add --dev \ + bash-language-server \ + dockerfile-language-server-nodejs \ + pyright \ + sql-language-server \ + typescript-language-server \ + unified-language-server \ + vscode-css-languageserver-bin \ + vscode-html-languageserver-bin \ + vscode-json-languageserver-bin \ + yaml-language-server + +conda install --quiet --yes -c conda-forge texlab chktex && \ + conda clean --all -f -y + # conda clean --all -f -y && \ + # fix-permissions "${CONDA_DIR}" && \ + # fix-permissions "/home/${NB_USER}" + +nbdime extensions --enable +# RUN conda install --quiet --yes --freeze-installed -c conda-forge \ +# 'python-language-server' \ +# 'jupyterlab=3.1.0' \ +# 'r-languageserver' \ +# 'texlab' \ +# 'chktex' \ +# 'jupyter-lsp=1.5.1' \ +# && jupyter labextension install --no-build \ +# '@krassowski/jupyterlab-lsp@3.10.1' \ +# && jupyter lab build --dev-build=False --minimize=True \ +# && conda clean --all -f -y \ +# && rm -rf \ +# $CONDA_DIR/share/jupyter/lab/staging \ +# /home/$NB_USER/.cache/yarn \ +# && fix-permissions $CONDA_DIR \ +# && fix-permissions /home/$NB_USER + + + + +jupyter lab build + + +# tlmgr update --self && tlmgr install scheme-full + +# install a package into the default (python 3.x) environment and cleanup after the installation +# mamba install --quiet --yes some-package && \ +# mamba clean --all -f -y && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# pip install --quiet --no-cache-dir some-package && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# conda install --quiet --yes some-package && \ +# conda clean --all -f -y && \ +# fix-permissions "${CONDA_DIR}" && \ +# fix-permissions "/home/${NB_USER}" + +# apt install -y libxss1 libappindicator1 libindicator7 +# wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +# dpkg -i google-chrome*.deb +# apt install -y -f