FROM python:3.12-slim WORKDIR /app # 编译依赖(llama-cpp-python 需要) RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ g++ \ make \ cmake \ build-essential \ && rm -rf /var/lib/apt/lists/* # 安装 Python 依赖(含 LLM + Embedding + Reranker) COPY yuanqi/pyproject.toml . RUN pip install --no-cache-dir -e ".[all]" # 复制源代码 COPY yuanqi/src/ src/ EXPOSE 11434 HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ CMD python -c "import urllib.request; import json; r = urllib.request.urlopen('http://localhost:11434/healthz'); d = json.loads(r.read()); assert d['status'] != 'error'" || exit 1 CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "11434"]