pyweb / Dockerfile
Bin29's picture
Update Dockerfile
d93b207 verified
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 *'}}"]