Files
2026-08-21 16:00:13 +08:00

27 lines
767 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"]