Spaces:
Configuration error
Configuration error
| # 使用官方Python 3.10 slim镜像 | |
| FROM python:3.10-slim | |
| # --- 1. [简化] 安装系统依赖 --- | |
| # 我们仍然需要git来克隆仓库,但不再需要build-essential和libgomp1 | |
| # 因为不再安装torch等需要编译的库 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # --- 2. 设置工作目录 --- | |
| WORKDIR /app | |
| # --- 3. [保留] 关键步骤:克隆私有仓库 --- | |
| # 这个经过验证的克隆步骤保持不变 | |
| RUN --mount=type=secret,id=GH_USER \ | |
| --mount=type=secret,id=GH_TOKEN \ | |
| git clone https://$(cat /run/secrets/GH_USER):$(cat /run/secrets/GH_TOKEN)@github.com/leoncool23/tcm_expert_builder.git . | |
| # --- 4. [简化] 安装Python依赖 --- | |
| # requirements.txt现在非常轻量 | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # --- 5. [移除] 移除所有NLTK和ChromaDB的配置 --- | |
| # ENV NLTK_DATA... 和 RUN python -m nltk.downloader... 等行被删除 | |
| # ENV ANONYMIZED_TELEMETRY=False 也被删除,因为不再使用chromadb | |
| # --- 6. 创建用户、目录和权限 --- | |
| RUN useradd --create-home --shell /bin/bash appuser | |
| # 确保data目录存在,因为graph_service会用到 | |
| RUN mkdir -p uploads data | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| # --- 7. 暴露端口 --- | |
| EXPOSE 7860 | |
| # --- 8. [简化] 启动应用 --- | |
| # 移除了所有诊断脚本,直接启动 | |
| CMD ["gunicorn", "--workers", "1", "--bind", "0.0.0.0:7860", "--timeout", "120", "app:app"] |