FROM python:3.12 WORKDIR /app RUN pip install --no-cache-dir --timeout 120 fastapi uvicorn requests pyyaml numpy httpx python-docx openpyxl python-pptx pdfplumber "xlrd==1.2.0" tavily-python ebooklib beautifulsoup4 mobi PyMuPDF RUN pip install --no-cache-dir --timeout 120 torch --index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir --timeout 120 sentence-transformers faiss-cpu # llama-cpp-python 预编译 wheel(30 秒,不需编译) RUN pip install --no-cache-dir --timeout 300 "llama-cpp-python>=0.3.4" \ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # 模型在 app.py startup 时按需下载(避免每次代码变更重下 4GB) # 全部源码、工具、配置 → 构建进镜像 COPY app.py /app/ COPY scripts /app/scripts/ COPY services /app/services/ COPY skills /app/skills/ # 自动拉取第三方技能(@ai install-skill 安装后自动进下次构建) RUN git clone --depth 1 --single-branch https://github.com/hughyonng/OpenWolf.git /tmp/update \ && cp -r /tmp/update/skills/third-party /app/skills/ 2>/dev/null || true \ && cp -r /tmp/update/skills/library /app/skills/ 2>/dev/null || true \ && rm -rf /tmp/update EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]