778ccefb22
后端 - 新增 app/task_progress.py 线程安全进度注册表 - 任务改为后台线程异步执行(_run_task_background),手动触发立即返回 task_key - 6 个任务函数(summarizer/tagger/scorer/deduplicator/brief/taxonomy)循环内上报进度 - scheduler 定时任务同步上报进度(trigger=scheduled) - 新增 GET /api/tasks/progress 与 POST /api/tasks/progress/reset 接口 - 新增 POST /api/test-connection 接口连通性测试(独立短超时客户端) - 修复 ai_client/rss_client 配置在 import 时固化的 bug(改为 property 运行时读取 settings), 导致实际任务用 .env 假 key 调 LLM 401 - 修复 ai_client 对 reasoning 模型(MiniMax-M3 等)输出 <think> 块的 JSON 解析失败 - 修复 taxonomy bootstrap:LLM 超时(改用 300s 专用 client)、MiniMax 输出审查 (精简样本仅标题 + 约束生成中性类目名)、失败误报 success(改抛异常如实标记) - 修复 models.py 双外键关系映射启动崩溃(显式 foreign_keys) - 修复 main.py SPA 路由 404、ArticleOut.published_at 序列化 500 - 移除 lifespan 同步 bootstrap 阻塞启动,改由 scheduler 后台异步执行 前端 - Deep Ink 高对比度暗色主题重构,修复 Element Plus 暗色模式对比度问题 - Tasks 页面任务进度实时展示(进度条/阶段/计数/状态/触发来源)+ 1.5s 轮询 - 接口测试面板(rssKeeper / LLM 连通性 + 延迟) - 修复 nextJobs jobId 映射 bug 部署与文档 - Dockerfile 优化(BuildKit 缓存挂载、预编译 wheel、去 gcc、阿里云镜像源) - 新增 API.md 接口文档 Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.4 KiB
Docker
48 lines
1.4 KiB
Docker
# Stage 1: 构建前端
|
||
FROM node:20-alpine AS frontend-builder
|
||
|
||
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
||
|
||
WORKDIR /app/frontend
|
||
COPY frontend/package*.json ./
|
||
RUN --mount=type=cache,target=/root/.npm \
|
||
npm install --registry=${NPM_REGISTRY}
|
||
COPY frontend/ .
|
||
RUN npm run build
|
||
|
||
# Stage 2: Python 后端
|
||
FROM python:3.12-slim
|
||
|
||
ARG PIP_INDEX=https://mirrors.aliyun.com/pypi/simple/
|
||
|
||
WORKDIR /app
|
||
|
||
# 先只 COPY requirements.txt,利用 Docker 层缓存——只要依赖不变就命中缓存
|
||
COPY requirements.txt .
|
||
|
||
# 用 --only-binary=:all: 强制只下载预编译 wheel,避免编译 scikit-learn
|
||
# 若平台无 wheel 会报错,但 x86_64 上 scikit-learn/numpy/scipy 都有
|
||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||
pip install --no-cache-dir -r requirements.txt \
|
||
-i ${PIP_INDEX} \
|
||
--trusted-host mirrors.aliyun.com \
|
||
--only-binary=:all: \
|
||
|| pip install --no-cache-dir -r requirements.txt \
|
||
-i ${PIP_INDEX} \
|
||
--trusted-host mirrors.aliyun.com
|
||
|
||
# 创建非 root 用户(不需要 gcc 了,去掉 apt-get 节省 ~40s)
|
||
RUN useradd --create-home --uid 1000 app
|
||
|
||
COPY . .
|
||
COPY --from=frontend-builder /app/frontend/dist ./static
|
||
|
||
# 确保数据目录对 app 用户可写
|
||
RUN mkdir -p /app/data && chown -R app:app /app/data
|
||
|
||
USER app
|
||
|
||
EXPOSE 7331
|
||
|
||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7331", "--workers", "1"]
|