gongxiangp2/scripts/README.md

64 lines
1.3 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 镜像
- 支持清理旧镜像
**使用方式:**
```powershell
# 部署到影子系统(端口 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
```