deploy: 挂目录+替换文件部署,构建产物到 deploy/,不重建 web/admin 镜像
Made-with: Cursor
This commit is contained in:
8
deploy/README.md
Normal file
8
deploy/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# deploy 目录(挂目录 + 替换文件部署)
|
||||
|
||||
- **deploy/web/dist**:前台构建产物,由 `pull-and-restart.sh` 生成;替换此目录内容即可更新前台。
|
||||
- **deploy/admin/dist**:后台构建产物,同上。
|
||||
- **deploy/api/server**:API 二进制,同上;替换后重启 api 容器生效。
|
||||
- **deploy/web/default.conf**、**deploy/admin/default.conf**:Nginx 配置,已纳入版本库。
|
||||
|
||||
日常更新:在服务器执行 `./pull-and-restart.sh` 会拉代码、重新构建到上述目录并重启容器。若只改静态资源,也可在服务器上手动构建后只重启对应容器。
|
||||
9
deploy/admin/default.conf
Normal file
9
deploy/admin/default.conf
Normal file
@@ -0,0 +1,9 @@
|
||||
# 外层 Nginx 已把 /admin/ 转成 / 转发到本容器,此处 location / 提供 SPA
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
17
deploy/web/default.conf
Normal file
17
deploy/web/default.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 根路径下的验证文件走热加载目录,替换文件即可生效
|
||||
location ~ ^/([A-Za-z0-9._-]+\.(txt|html|xml))$ {
|
||||
alias /verify-root/$1;
|
||||
}
|
||||
|
||||
location = / {
|
||||
try_files /index.html =404;
|
||||
}
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user