feat:新增部署脚本
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
FROM python:3.11-slim-bookworm AS builder
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.17 /uv /usr/local/bin/uv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV UV_PYTHON_DOWNLOADS=never
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --locked --no-dev --no-install-project
|
||||
|
||||
FROM python:3.11-slim-bookworm
|
||||
|
||||
# PyArrow、DuckDB 的 Linux wheels 需要 C++ 运行库
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends libstdc++6 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PATH="/app/.venv/bin:$PATH" \
|
||||
UVICORN_HOST=0.0.0.0 \
|
||||
UVICORN_PORT=8000
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/.venv ./.venv
|
||||
COPY app ./app
|
||||
COPY mcp_servers ./mcp_servers
|
||||
COPY mcp_servers.json ./
|
||||
COPY skills ./skills
|
||||
COPY scripts/seed_materials.py ./scripts/seed_materials.py
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \
|
||||
CMD python -c "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ['UVICORN_PORT'] + '/api/files/limits', timeout=3).close()" || exit 1
|
||||
|
||||
CMD ["python", "-m", "uvicorn", "app.main:app", "--workers", "1"]
|
||||
Reference in New Issue
Block a user