This commit is contained in:
zyp
2026-11-18 16:01:50 +08:00
parent 0dc48ad092
commit 0c3d0c1ce4
30 changed files with 1525 additions and 93 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
command -v docker >/dev/null || { echo "请先安装 Docker Engine 和 Docker Compose v2。" >&2; exit 1; }
docker compose version >/dev/null
if [[ "$(docker info --format '{{.OSType}}')" != linux ]]; then
echo "此部署包需要运行 Linux 容器的 Docker。" >&2
exit 1
fi
version=$(cat VERSION)
[[ "$version" =~ ^[0-9]{8}-[0-9]{6}$ ]] || { echo "VERSION 格式不正确。" >&2; exit 1; }
[[ -s image-source.tar.gz ]] || { echo "缺少镜像源码包。" >&2; exit 1; }
if [[ ! -e assistant.env ]]; then
[[ -f assistant.env.initial ]] || { echo "缺少初始配置 assistant.env.initial。" >&2; exit 1; }
(umask 077; cp assistant.env.initial assistant.env)
fi
[[ -f assistant.env && -s assistant.env ]] || { echo "assistant.env 必须是有效配置文件。" >&2; exit 1; }
mkdir -p data/checkpoints data/jobs
# Read a fresh build context from the archive; deleted source files cannot linger
# from an earlier release. The context contains neither credentials nor databases.
echo "正在构建智能体 $version;现有服务会继续运行到构建完成。"
docker build --tag "company-ai-assistant:$version" --tag company-ai-assistant:local - < image-source.tar.gz
# Runtime credentials are mounted as a file and parsed by python-dotenv, never
# interpreted as shell code or interpolated by Compose.
echo "正在启动或更新服务,并等待健康检查。"
docker compose --env-file /dev/null -f compose.yml up -d --wait --wait-timeout 120
docker compose --env-file /dev/null -f compose.yml ps
echo "部署完成。Java 智能体地址:http://服务器地址:${ASSISTANT_PORT:-8000}/api/v1/work-assistant"