FROM python:3.11-slim ENV DEBIAN_FRONTEND=noninteractive # 安装依赖项 RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ texlive-latex-base \ texlive-fonts-recommended \ texlive-latex-recommended \ texlive-xetex \ lmodern \ curl \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* # 添加用户 RUN useradd -m -u 1000 user # 设置环境变量 ENV HOME=/home/user \ PATH="/home/user/.local/bin:$PATH" USER user # 拷贝应用文件并安装依赖 COPY --chown=user . $HOME/app WORKDIR $HOME/app/hf_app RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir streamlit \ && pip install --no-cache-dir -r ../requirements.txt # 运行 Streamlit 应用 CMD ["streamlit", "run", "app.py", "--server.port", "8200"]