File size: 1,199 Bytes
49e0f6f
 
 
 
 
 
 
 
 
 
 
 
 
 
1128546
49e0f6f
 
 
 
 
 
 
 
 
 
1128546
d93b207
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM python:3.10-slim

# 1. 安装系统基础组件
RUN apt-get update && apt-get install -y \
    curl wget fontconfig libgl1 libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# 2. 安装“霞鹜文楷”字体
RUN mkdir -p /usr/share/fonts/truetype/lxgw && \
    wget https://github.com/lxgw/LxgwWenKai/releases/download/v1.330/LXGWWenKai-Regular.ttf -O /usr/share/fonts/truetype/lxgw/LXGWWenKai-Regular.ttf && \
    fc-cache -fv

# 3. 安装最精简的库 (去掉了没用的依赖)
RUN pip install --no-cache-dir numpy matplotlib notebook
RUN pip install jupyterlab-language-pack-zh-CN

# 4. 设置用户和工作目录
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
RUN chown -R user:user /home/user/app

# 5. 切换到用户
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
    
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=7860", "--no-browser", "--allow-root", "--ServerApp.token='pyweb1001'", "--ServerApp.password=''", "--ServerApp.allow_origin='*'", "--ServerApp.allow_remote_access=True", "--ServerApp.disable_check_xsrf=True", "--ServerApp.language='zh_CN'", "--ServerApp.tornado_settings={'headers':{'Content-Security-Policy':'frame-ancestors *'}}"]