update
This commit is contained in:
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
FROM debian:bullseye
|
||||||
|
|
||||||
|
RUN <<EOT
|
||||||
|
#!/bin/bash
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm
|
||||||
|
npm install -g configurable-http-proxy
|
||||||
|
python3 -m pip install jupyterhub jupyterlab notebook jupyter-rsession-proxy ipykernel jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator jupyter_contrib_nbextensions jupyterlab-unfold jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim \
|
||||||
|
nbresuse ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 xeus-python jupyterlab-lsp python-lsp-server nglview dockerspawner lckr_jupyterlab_variableinspector -i https://mirrors.aliyun.com/pypi/simple
|
||||||
|
mkdir -p ~/.jupyterhub
|
||||||
|
EOT
|
||||||
|
|
||||||
|
COPY jupyterhub_config.py /root/.jupyterhub
|
||||||
|
EXPOSE 9000
|
||||||
|
|
||||||
|
ENTRYPOINT [ "jupyterhub", "-f", "/root/.jupyterhub/jupyterhub_config.py" ]
|
||||||
60
jupyterhub_config.py
Normal file
60
jupyterhub_config.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
c = get_config()
|
||||||
|
|
||||||
|
c.JupyterHub.cookie_secret_file = os.path.expanduser('~/.jupyterhub/jupyterhub_cookie_secret')
|
||||||
|
db_file = os.path.expanduser('~/.jupyterhub/jupyterhub.sqlite')
|
||||||
|
c.JupyterHub.db_url = 'sqlite:///{}'.format(db_file)
|
||||||
|
c.ConfigurableHTTPProxy.pid_file = os.path.expanduser('~/.jupyterhub/jupyterhub-proxy.pid')
|
||||||
|
|
||||||
|
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
|
||||||
|
c.JupyterHub.ip = '0.0.0.0'
|
||||||
|
c.JupyterHub.port = 9000
|
||||||
|
c.JupyterHub.page_title = 'JupyterHub Service'
|
||||||
|
c.Spawner.ip = '127.0.0.1'
|
||||||
|
c.Spawner.cmd = ['jupyter-labhub']
|
||||||
|
|
||||||
|
# dockerspawner config
|
||||||
|
#c.JupyterHub.spawner_class=DockerSpawner
|
||||||
|
# pick a default image to use when none is specified
|
||||||
|
#c.DockerSpawner.image = "jupyter/base-notebook"
|
||||||
|
#c.JupyterHub.authenticator_class = "dummy"
|
||||||
|
|
||||||
|
# we need the hub to listen on all ips when it is in a container
|
||||||
|
#c.JupyterHub.hub_ip = '0.0.0.0'
|
||||||
|
|
||||||
|
# delete containers when they stop
|
||||||
|
#c.DockerSpawner.remove = True
|
||||||
|
|
||||||
|
# this is usually the hub container's name
|
||||||
|
# c.JupyterHub.hub_connect_ip = 'jupyterhub'
|
||||||
|
|
||||||
|
# tell the user containers to connect to our docker network
|
||||||
|
# c.DockerSpawner.network_name = 'jupyterhub'
|
||||||
|
|
||||||
|
# 设置 Docker 守护进程的地址和端口
|
||||||
|
# os.environ['DOCKER_HOST'] = 'tcp://192.168.101.50:2376'
|
||||||
|
|
||||||
|
# 如果使用 TLS
|
||||||
|
#os.environ['DOCKER_TLS_VERIFY'] = '1'
|
||||||
|
#os.environ['DOCKER_CERT_PATH'] = '/path/to/certificates'
|
||||||
|
#c.DockerSpawner.docker_host = 'tcp://192.168.101.50:2376'
|
||||||
|
#c.DockerSpawner.remove = True
|
||||||
|
#c.DockerSpawner.image = 'quay.io/jupyter/scipy-notebook:2023-10-23'
|
||||||
|
|
||||||
|
c.Spawner.default_url = '/lab'
|
||||||
|
c.PAMAuthenticator.encoding = 'utf8'
|
||||||
|
c.Authenticator.allowed_users = set()
|
||||||
|
c.LocalAuthenticator.create_system_users = True
|
||||||
|
c.LocalProcessSpawner.shell_cmd = ["bash", "-l", "-c"]
|
||||||
|
c.Authenticator.admin_users = set()
|
||||||
|
c.Spawner.args = ['--allow-root', "--KernelSpecManager.ensure_native_kernel=False", '--NotebookApp.allow_origin_pat=https://.*vscode-cdn\\.net', '--NotebookApp.iopub_data_rate_limit=10000000'] # 增加nglview、vscode的jupyterhub的插件的支持
|
||||||
|
c.JupyterHub.statsd_prefix = 'jupyterhub'
|
||||||
|
c.Spawner.notebook_dir = '~'
|
||||||
|
c.JupyterHub.shutdown_on_logout = False
|
||||||
|
c.PAMAuthenticator.open_sessions = False
|
||||||
|
c.Spawner.env_keep.append('ENV1')
|
||||||
|
c.Spawner.env_keep.append('ENV2')
|
||||||
|
c.Spawner.env_keep.append('LD_LIBRARY_PATH')
|
||||||
|
c.Spawner.env_keep.append('PATH')
|
||||||
|
|
||||||
Reference in New Issue
Block a user