部署方式改为宿主构建 + 容器挂载,适配小内存 ECS

This commit is contained in:
zhongluofeng authored and trae-solo-agent committed 2026-10-30 17:28:38 +08:00
1 parent 0c30c79696
commit 22aa0ef402
4 files changed
+52 -3

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# ECS 部署脚本:拉代码 -> 宿主构建 -> 容器重启
# 用法:在服务器上执行 bash scripts/deploy.sh
set -euo pipefail
cd "$(dirname "$0")/.."
# 服务器上的 Node 装在 /opt/node(系统未自带 Node)
export PATH=/opt/node/bin:$PATH
if [ ! -f .env ]; then
echo "缺少 .env,请先从 .env.example 复制并填写" >&2
exit 1
fi
echo "==> 同步代码"
git fetch --depth 1 origin main
git reset --hard origin/main
echo "==> 安装依赖"
pnpm install --frozen-lockfile
echo "==> 构建"
NODE_OPTIONS=--max-old-space-size=768 pnpm build
echo "==> 重启容器"
docker compose up -d --force-recreate
echo "==> 健康检查"
sleep 3
curl -fsS -o /dev/null -w 'http %{http_code}\n' http://127.0.0.1:3010/