gongxiangp2/scripts/README.md

69 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 脚本说明
## 核心部署脚本
### `deploy-local-build.ps1` ⭐
**主部署脚本** - 本地构建镜像并部署到服务器
- 支持影子系统和正式系统
- 本地构建 Docker 镜像
- 支持清理旧镜像
**重要提示:**
- ⚠️ **文件位置**:此脚本位于**项目根目录**(`d:\gongxiangp2\deploy-local-build.ps1`),**不在** `scripts` 目录
- ⚠️ **错误记录**:之前误判文件不存在,实际文件存在于项目根目录,请勿重复此错误
**使用方式:**
```powershell
# 在项目根目录执行(d:\gongxiangp2\)
# 部署到影子系统(端口 5320)
.\deploy-local-build.ps1 -Target shadow
# 部署到正式系统(端口 4320)
.\deploy-local-build.ps1 -Target production
# 部署并清理旧镜像
.\deploy-local-build.ps1 -Target production -CleanImages
# 跳过构建,直接部署
.\deploy-local-build.ps1 -Target shadow -SkipBuild
# 显示帮助
.\deploy-local-build.ps1 -Help
```
## 基础镜像管理
### `save-base-images.ps1`
下载并保存基础镜像到本地缓存
```powershell
.\save-base-images.ps1
```
### `load-base-images.ps1`
从本地加载基础镜像(部署脚本会自动调用)
```powershell
.\load-base-images.ps1
```
### `save-npm-packages.ps1`(可选)
缓存 npm 包到本地(网络不稳定时使用)
```powershell
.\save-npm-packages.ps1
```
## 数据库迁移脚本
### `execute-migration.ps1`
在生产库上执行数据库迁移(Windows PowerShell)
```powershell
.\execute-migration.ps1
```
### `execute-migration.sh`
在生产库上执行数据库迁移(Linux/Mac)
```bash
chmod +x execute-migration.sh
./execute-migration.sh
```