chore(deploy): 本地部署脚本、容器配置与运行说明

PostgreSQL/pgvector 与 Redis 独立容器,后端、worker、前端可一键启停;不覆盖既有密钥。
This commit is contained in:
WangShen007 committed 2026-10-19 21:30:00 +08:00
1 parent 83a16ed07d
commit 5be5ca3376
18 files changed
+1796

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
FROM python:3.12-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
netcat-traditional \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies. Bump pip's per-request timeout and retry count so
# the large opencv/onnxruntime wheel downloads survive slow links and the
# heavier amd64/x86_64 wheels don't abort with ReadTimeoutError.
ENV PIP_DEFAULT_TIMEOUT=120
COPY backend/requirements.txt .
RUN pip install --no-cache-dir --retries 10 -r requirements.txt
# Node.js + npx and uv/uvx for STDIO MCP servers (npx @elastic/mcp-server-…,
# uvx mcp-server-…). Copied from the official images instead of apt, which
# only ships an EOL Node 18 on bookworm. Kept below the pip layer so an
# upstream node/uv tag bump can't invalidate the cached pip layer.
COPY --from=node:22-slim /usr/local/bin/node /usr/local/bin/node
COPY --from=node:22-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /uvx /usr/local/bin/
# Copy application code
COPY backend/app ./app
COPY backend/alembic.ini .
COPY backend/alembic ./alembic
COPY backend/scripts ./scripts
COPY backend/assets ./assets
# Create required directories including cache directories
RUN mkdir -p uploads/agents && \
mkdir -p .cache/huggingface/hub && \
chmod -R 755 .cache
# Make startup script executable
RUN chmod +x ./scripts/start.sh
# Set environment variables
ENV PYTHONPATH=/app
ENV PORT=8000
# Set HuggingFace cache directories
ENV HF_HOME=/app/.cache/huggingface
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
ENV HF_HUB_DISABLE_TELEMETRY=1
# Expose the port
EXPOSE 8000
# Run the startup script
CMD ["./scripts/start.sh"]