This commit is contained in:
whm
2026-03-18 18:11:54 +08:00
parent c9d9224a68
commit 07f55e0139
3 changed files with 52 additions and 13 deletions

View File

@@ -97,10 +97,10 @@ docker compose up -d --build
2. **服务器**:进入项目目录,**以 Gitea 为准**,直接执行拉取并重启脚本(脚本内会 `git fetch` + `git reset --hard origin/master`,本地修改会被覆盖)。
```bash
cd /www/yh_web # 或你的项目路径
export REGISTRY_MIRROR=docker.m.daocloud.io/library/ # 可选,脚本有默认
./pull-and-restart.sh
```
若你已手动执行过 `git pull` 且报错 `Your local changes would be overwritten`,先以远程为准:`git fetch origin && git reset --hard origin/master`,再执行 `./pull-and-restart.sh`。脚本内已含默认 `REGISTRY_MIRROR`,一般直接 `./pull-and-restart.sh` 即可
**重要**`deploy/` 下构建产物web/admin 静态文件、api 二进制)**不在仓库里**,仅靠 `git pull` 不会生成。拉取后**必须执行** `./pull-and-restart.sh`(或 `./restart.sh`)才会构建并启动,否则访问会 403/404。脚本已记录可执行权限拉取后可直接 `./pull-and-restart.sh`,无需 chmod
若你已手动执行过 `git pull` 且报错 `Your local changes would be overwritten`,先以远程为准:`git fetch origin && git reset --hard origin/master`,再执行 `./pull-and-restart.sh`。
采用**挂目录 + 替换文件**部署:脚本将 web/admin 构建到 `deploy/web/dist`、`deploy/admin/dist`api 二进制到 `deploy/api/server`,容器挂载这些目录;更新时只重新构建产物并重启,无需重建前端镜像,仅 api 使用轻量运行时镜像。详见 `deploy/README.md`。构建会从 DaoCloud 等镜像拉取 node、nginx、golang、alpine、mongo启动后**对外仅 443**,由 compose 内 Nginx 反代到 api/web/admin证书按脚本自动处理。