deploy: 本地预构建发布(push-build),对齐 1Panel 与 backend_v2 目录

- 新增 Dockerfile.prebuilt / scripts/push-build.sh:本机构建、只上传产物,服务器零编译
- deploy.sh 增加 --prebuilt(自动 --no-pull + 产物校验),并保留 --no-cache
- compose 支持 BACKEND_DOCKERFILE / WEB_DOCKERFILE 切换;预构建时用 prebuilt 变体
- init-db.sh / scripts/backup-db.sh 改为 docker exec 1Panel 的 Postgres 容器
- WEB_DIR 默认改为 ../frontend_v2;nginx 切换文件改到 .deploy/ 避免弄脏工作区
- 新增 .gitattributes 固定脚本与配置为 LF
This commit is contained in:
toom1996
2026-10-21 00:02:18 +08:00
parent 822dd69911
commit 2e76507d37
11 changed files with 308 additions and 25 deletions

View File

@ -116,6 +116,8 @@ services:
<<: *backend-base
build:
context: .
# 默认在容器内编译;本地预构建时由 deploy.sh --prebuilt 切到 Dockerfile.prebuilt
dockerfile: ${BACKEND_DOCKERFILE:-Dockerfile}
args:
GOPROXY: ${GOPROXY:-https://goproxy.cn,direct}
@ -127,6 +129,8 @@ services:
<<: *web-base
build:
context: ${WEB_DIR:-../test}
# 默认在容器内 npm ci + astro build;本地预构建时切到 Dockerfile.prebuilt
dockerfile: ${WEB_DOCKERFILE:-Dockerfile}
args:
# 走宿主回环的代理 18091,由代理转发到活跃后端槽
BASE_API_SSG: http://127.0.0.1:18091