Skip to content

Commit

Permalink
chore: provider a docker image with ull feature supports
Browse files Browse the repository at this point in the history
  • Loading branch information
BroKun authored and sunshinesmilelk committed Nov 15, 2024
1 parent 9a7427d commit 7282f62
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 使用 python 3.11 作为基础镜像
FROM python:3.11-slim-bookworm
# 使用 python 3.11 nodejs 20作为基础镜像
FROM nikolaik/python-nodejs:python3.11-nodejs20-slim

# 创建 ADMIN 用户并设置其为非特权用户
RUN useradd -m admin

# 安装 libro 包
RUN pip install libro
RUN pip install libro-flow
RUN npm install @difizen/libro-analyzer -g

# 创建 Jupyter 配置目录和工作区目录
RUN mkdir -p /home/admin/.jupyter /home/admin/workspace
Expand All @@ -28,5 +30,8 @@ USER admin
# 设置工作目录为 admin 用户的主目录
WORKDIR /home/admin

# 设置容器的默认端口
EXPOSE 6780

# 使用 ENTRYPOINT 来设置启动脚本
ENTRYPOINT ["/home/admin/start.sh"]
28 changes: 28 additions & 0 deletions docker/jupyter_server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1779,3 +1779,31 @@
# "display_name": "libro-analyzer",
# },
# }


c.LanguageServerManager.autodetect = False
# c is a magic, lazy variable
c.LanguageServerManager.language_servers = {
"ruff-lsp": {
# if installed as a binary
"argv": [
"ruff-lsp",
],
"languages": ["python"],
"version": 2,
"mime_types": ["text/x-python"],
"display_name": "ruff-lsp",
},
"libro-analyzer": {
# if installed as a binary
"argv": [
"node",
"/usr/local/lib/node_modules/@difizen/libro-analyzer/index.js",
"--stdio",
],
"languages": ["python"],
"version": 2,
"mime_types": ["text/x-python"],
"display_name": "libro-analyzer",
},
}
8 changes: 6 additions & 2 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash

# PORT 默认值为 6780
LIBRO_PORT=6780
# 检查 PORT 环境变量是否设置
if [ -z "$PORT" ]; then
echo "PORT 环境变量未设置"
exit 1
else
echo "PORT 环境变量设置为 $PORT"
LIBRO_PORT=$PORT
fi

# 启动 libro,并将 PORT 环境变量传递给它
exec libro --port="$PORT" --notebook-dir="/home/admin/workspace"
exec libro --port="$LIBRO_PORT" --notebook-dir="/home/admin/workspace"

0 comments on commit 7282f62

Please sign in to comment.