本项目提供了一系列渐进式的 Jupyter 环境配置示例,从单用户容器到多用户 AI 增强环境,帮助你理解和构建适合自己需求的 Jupyter 环境。
. ├── 01-single-container/ # 单用户 Jupyter 环境 ├── 02-jupyterhub/ # 基础多用户环境 ├── 03-jupyterhub-github-auth/ # GitHub 认证集成 └── 04-jupyterhub-ai-enhanced/ # AI 增强版本
基础的单用户 Jupyter 环境,适合个人使用或学习 Docker 容器化部署。
特性:
文件结构:
01-single-container/ ├── Dockerfile # 容器定义 ├── docker-compose.yml # 服务编排配置 ├── requirements.txt # Python 依赖 ├── data/ # 数据目录 └── notebooks/ # 笔记本目录
基础的多用户 JupyterHub 环境,支持多用户独立工作空间。
特性:
文件结构:
02-jupyterhub/ ├── Dockerfile.jupyterhub # JupyterHub 容器定义 ├── docker-compose.yml # 多容器服务编排 ├── jupyterhub_config.py # JupyterHub 配置 └── tests/ # 测试目录
集成 GitHub 认证的 JupyterHub 环境。
特性:
文件结构:
03-jupyterhub-github-auth/ ├── .env.example # 环境变量模板 ├── Dockerfile.jupyterhub # JupyterHub 容器定义 ├── docker-compose.yml # 服务编排配置 └── jupyterhub_config.py # GitHub 认证配置
AI 增强版 JupyterHub 环境,集成多个 AI 模型和工具。
特性:
文件结构:
04-jupyterhub-ai-enhanced/ ├── Dockerfile.jupyterhub # JupyterHub 容器定义 ├── Dockerfile.notebook # AI 笔记本容器定义 ├── docker-compose.yml # 服务编排配置 ├── ai-config/ # AI 配置目录 ├── examples/ # AI 示例笔记本 ├── start.sh # 启动脚本 └── stop.sh # 停止脚本
git clone <repository-url>
cd <repository-name>
cd 01-single-container
docker-compose up -d
cd 02-jupyterhub
docker-compose up -d
cd 03-jupyterhub-github-auth
cp .env.example .env
# 编辑 .env 文件,添加 GitHub OAuth 配置
docker-compose up -d
cd 04-jupyterhub-ai-enhanced
cp .env.example .env
# 编辑 .env 文件,添加必要的 API 密钥
./start.sh
AI 增强环境支持以下配置:
# GitHub OAuth GITHUB_CLIENT_ID=your_client_id GITHUB_CLIENT_SECRET=your_client_secret OAUTH_CALLBACK_URL=http://localhost:8000/hub/oauth_callback # AI API Keys OPENAI_API_KEY=your_openai_key ANTHROPIC_API_KEY=your_anthropic_key HUGGINGFACE_API_KEY=your_huggingface_key # 国内大模型配置 DASHSCOPE_API_KEY=your_dashscope_key DEEPSEEK_API_KEY=your_deepseek_key OLLAMA_BASE_URL=http://localhost:11434 # AI 默认配置 JUPYTER_AI_MODEL_PROVIDER=openai JUPYTER_AI_DEFAULT_MODEL=gpt-3.5-turbo # 资源限制 DOCKER_MEM_LIMIT=4G DOCKER_CPU_LIMIT=2.0
访问 JupyterHub:
http://localhost:8000用户认证:
AI 功能使用:
安全性:
资源管理:
数据备份:
欢迎提交 Issue 和 Pull Request 来帮助改进项目。
本项目采用 Modified BSD License 许可证。