diff --git a/AGENTS.md b/AGENTS.md index c7f6389..a40cd63 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,17 +20,36 @@ # 1. 本地构建 cd frontend/sidebar && npm run build -# 2. 同步到服务器 +# 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 登录服务器,重新构建镜像并重启容器 +# 3. SSH 登录服务器,更新 index.html 缓存戳并重启容器 ssh -o StrictHostKeyChecking=no -i root.pem root@8.133.162.25 << 'EOF' -cd /www/wwwroot/deploy-package/frontend/sidebar -docker build -t deploy-package-sidebar . -docker stop ai-assistant-sidebar -docker rm ai-assistant-sidebar -cd /www/wwwroot/deploy-package -docker-compose up -d sidebar +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 + + +
+ + + +