Files
agent-safe-middleware/deploy/docker/.env.example
T
chenleixu b82e44ec32 feat: Docker 打包、交付链路与命名脱敏
镜像与构建
- 六阶段 Dockerfile(base/wheels/deps/manifest/core|guard),core 不含 torch
- 构建期自证:gen_manifest --strict 拦未登记模块,core 阶段重算 sha256
- compose 四服务 host 网络(llm.url 强制回环),config.core/local 可挂载覆盖

无 docker 环境的四段链路
- pull_oci_image.py      直拉 OCI 镜像 rootfs(纯标准库,走加速器)
- replay_image_build.sh  按 stage chroot 重放 Dockerfile
- run_image_chroot.sh    等价 docker run(uid 10001 + 入口 + host 网络)
- pack_image.py          封成 docker save 格式包,自带 diff_id 校验

交付
- make_package.sh 生成自包含目录:镜像包 + 溯源清单 + 构建输入 + 脚本 + 源码快照
- 文档:从零复现指南、docker 打包方案、镜像构建限制与替代方案、交付包 README

命名
- Qwen 品牌名统一替换为 large_model / small_model / large_model_guard,
  覆盖 vLLM 服务名、模型目录、配置、脚本、测试与文档
- 模型架构字段(architectures / model_type / tokenizer_class)属上游定义,
  改名会导致加载失败,保留原值;check_local_model.py 的架构判断同理

验证:smoke 6/6;test.py 20 通过 0 失败 1 警告;gen --strict 67 文件 / 22 进镜像
2026-11-27 18:20:16 +00:00

46 lines
2.2 KiB
Bash
Raw 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.
# 编排参数:复制为仓库根的 .env 后按机器改
#
# cp deploy/docker/.env.example .env
#
# compose 会自动读取同目录的 .env;.dockerignore 已排除它,不会进镜像。
# --------------------------------------------------------------------------- #
# 端口:所有服务都是 network_mode: host,端口直接监听在宿主,没有 ports: 映射。
# 网关 → deploy/docker/config.core.yaml 的 listen_port(默认 8080)
# vLLM → docker-compose.yml 里各自的 --port(8001 / 8003 / 8005)
# 客户端与 APISIX 都打宿主 IP:8080。
# --------------------------------------------------------------------------- #
# --------------------------------------------------------------------------- #
# 模型根目录:下面三个模型都在它下面,按子目录名找
# ${MODEL_DIR}/large_model 基础模型,client 侧 model=large_model
# ${MODEL_DIR}/small_model 0.6B 守卫,一级判定
# ${MODEL_DIR}/large_model_guard 8B 守卫(LoRA 合并版),二级复核
# 相对路径按仓库根解析;用绝对路径更稳。
# --------------------------------------------------------------------------- #
MODEL_DIR=./models
# --------------------------------------------------------------------------- #
# GPU 分配:填 nvidia-smi 里的编号。每个服务独占一张卡最省心。
# 卡少时按《从零复现指南》附录 B 把 0.6B 与 8B 守卫并到同一张卡,并下调
# docker-compose.yml 里的 --gpu-memory-utilization。
# --------------------------------------------------------------------------- #
GPU_UPSTREAM=0
GPU_GUARD06=1
GPU_GUARD8=2
# --------------------------------------------------------------------------- #
# 构建参数
# --------------------------------------------------------------------------- #
# 1 = 额外装 LibreOffice(约 +400 MB),只有需要审 .doc 老格式附件时才开
WITH_DOC_CONVERTER=0
# 溯源用:写进镜像 OCI label,不参与构建缓存
GIT_REV=unknown
BUILD_TIME=unknown
# --------------------------------------------------------------------------- #
# 仅 --profile local(进程内 transformers 过渡形态)需要
# --------------------------------------------------------------------------- #
MODEL_06=./models/small_model