diff --git a/AGENTS.md b/AGENTS.md index 91f62eb..04bf05b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,35 +23,20 @@ cd frontend/sidebar && npm run build # 2. 同步到服务器(注意带 JS hash 的文件名会变化) scp -r -o StrictHostKeyChecking=no -i root.pem frontend/sidebar/dist/* root@8.133.162.25:/www/wwwroot/deploy-package/frontend/sidebar/dist/ -# 3. SSH 登录服务器,更新 index.html 缓存戳并重启容器 +# 3. SSH 登录服务器,重建镜像并重建容器(持久化,容器再被 recreate 也不会回滚) +# ⚠️ 禁止再用 docker cp 更新 sidebar:cp 进容器可写层的内容在容器 recreate 时会全部丢失 +# (2026-09-03 容器被重建后回滚到 6 月旧镜像,summary-search/reminder 页面线上故障) +# ⚠️ 服务器 Dockerfile 直接 COPY 服务端 dist/ 与 nginx.conf,故必须先完成第 2 步 scp ssh -o StrictHostKeyChecking=no -i root.pem root@8.133.162.25 << 'EOF' -cd /www/wwwroot/deploy-package/frontend/sidebar/dist -# 更新 index.html 中的 JS/CSS 引用,带上版本戳防缓存 -JS_FILE=$(ls assets/index-*.js | head -1) -CSS_FILE=$(ls assets/index-*.css | head -1) -cat > index.html << HTML - - - - - - - AI坐席助手 - - - - - -
- - -HTML -# 复制到容器并重启 -docker cp . ai-assistant-sidebar:/usr/share/nginx/html/ -# 若 frontend/sidebar/nginx.conf 有变更(如新增页面路由),需同步到容器再 reload -docker cp ../nginx.conf ai-assistant-sidebar:/etc/nginx/conf.d/default.conf -docker exec ai-assistant-sidebar nginx -t && docker exec ai-assistant-sidebar nginx -s reload +cd /www/wwwroot/deploy-package +docker-compose build sidebar +docker-compose up -d --no-deps sidebar +# 容器重建后 IP 变化,外层 nginx 需重启重新解析 DNS docker restart ai-assistant-nginx +# 自检:三个入口应返回各自标题,且 size 互不相同 +curl -sk https://ai.9artedu.com/sidebar/summary | grep -o '[^<]*' +curl -sk https://ai.9artedu.com/sidebar/summary-search | grep -o '[^<]*' +curl -sk https://ai.9artedu.com/sidebar/reminder | grep -o '[^<]*' EOF ```