Files
hunjing/docker/Dockerfile.backend
chenxin 21eacc8c75 ✨ feat: WP-14 运营收口——诊断双授权、管理面治理、支持包、观测与自托管
- 迁移 16:diagnostic_grant(token 哈希唯一、15 分钟、单次、绑定 Run)+ user.role(user/admin 检查约束)
- 诊断双授权(ADR-004):本人签发 grant(明文 token 只返回一次,库存 SHA-256);读取需登录态 + Hunjing-Diagnostic-Token + Purpose 三重匹配;单次消耗(重放 401)、用途不符 403、响应 no-store/private;返回观测摘要(usage/TTFT/工具轨迹)不含消息正文
- 管理面:pending 司议案列表与处置(content_removed 联动下架目标内容——治理闭环);非管理员 403
- 脱敏支持包:统计聚合(runs/messages/tool/media 按状态),无正文无密钥
- 观测:GET /readyz(DB 连通)与 GET /metrics(Prometheus 文本,真实 SQL 聚合)
- 自托管:docker/Dockerfile.backend(uv 构建)+ docker-compose.app.yml(hunjing-api + hunjing-postgres 健康依赖、密码经 .env);Makefile 新增 selfhost-up/down、db-dump/db-restore(备份到 backups/)
- 测试 94 项全绿(+3):诊断全路径(无令牌/用途不符/成功/单次重放)、管理面处置联动、支持包与指标
2026-09-12 11:20:15 +08:00

18 lines
427 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.
# Hunjing backend 镜像(uv + slim)
FROM python:3.12-slim AS base
WORKDIR /app
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# 先装依赖(层缓存)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project
# 源码与引擎绑定(绑定随源构建)
COPY . .
RUN uv sync --frozen
EXPOSE 8000
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]