Fix release configuration and add PowerShell build script
Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled
Some checks failed
Build and Deploy / test-backend (push) Has been cancelled
Build and Deploy / build-backend (push) Has been cancelled
Build and Deploy / build-admin (push) Has been cancelled
Deploy to Production / build-backend (push) Has been cancelled
Deploy to Production / deploy (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -26,5 +26,3 @@ services:
|
||||
context: ./deploy/nginx
|
||||
dockerfile: Dockerfile
|
||||
image: registry.667788.cool/wecom-nginx:${TAG:-latest}
|
||||
tags:
|
||||
- registry.667788.cool/wecom-nginx:${TAG:-latest}
|
||||
|
||||
74
scripts/build_and_push.ps1
Normal file
74
scripts/build_and_push.ps1
Normal file
@@ -0,0 +1,74 @@
|
||||
# 构建并推送 Docker 镜像到私有 Registry (PowerShell 版本)
|
||||
# 用途:构建 backend、admin、nginx 镜像并推送到 registry.667788.cool
|
||||
# 使用: .\scripts\build_and_push.ps1 [TAG]
|
||||
# 示例: .\scripts\build_and_push.ps1 v1.0.0
|
||||
|
||||
param(
|
||||
[string]$Tag = "latest"
|
||||
)
|
||||
|
||||
$Registry = "registry.667788.cool"
|
||||
|
||||
Write-Host "=== 构建并推送 Docker 镜像 ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Registry: $Registry" -ForegroundColor Gray
|
||||
Write-Host "Tag: $Tag" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
# 检查 docker compose 命令
|
||||
$dockerComposeCmd = $null
|
||||
if (Get-Command docker-compose -ErrorAction SilentlyContinue) {
|
||||
$dockerComposeCmd = "docker-compose"
|
||||
} elseif (docker compose version 2>$null) {
|
||||
$dockerComposeCmd = "docker compose"
|
||||
} else {
|
||||
Write-Host "错误: 未找到 docker-compose 或 docker compose 命令" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 登录 registry
|
||||
Write-Host "1. 登录 registry..." -ForegroundColor Yellow
|
||||
docker login $Registry
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "✗ 登录失败,请检查凭据" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ 登录成功" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# 构建镜像
|
||||
Write-Host "2. 构建镜像..." -ForegroundColor Yellow
|
||||
$env:TAG = $Tag
|
||||
if ($dockerComposeCmd -eq "docker-compose") {
|
||||
docker-compose -f docker-compose.release.yml build
|
||||
} else {
|
||||
docker compose -f docker-compose.release.yml build
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "✗ 构建失败" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ 构建成功" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# 推送镜像
|
||||
Write-Host "3. 推送镜像..." -ForegroundColor Yellow
|
||||
if ($dockerComposeCmd -eq "docker-compose") {
|
||||
docker-compose -f docker-compose.release.yml push
|
||||
} else {
|
||||
docker compose -f docker-compose.release.yml push
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "✗ 推送失败" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "✓ 推送成功" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "=== 完成 ✅ ===" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "镜像已推送到:" -ForegroundColor Cyan
|
||||
Write-Host " - $Registry/wecom-backend:$Tag" -ForegroundColor Gray
|
||||
Write-Host " - $Registry/wecom-admin:$Tag" -ForegroundColor Gray
|
||||
Write-Host " - $Registry/wecom-nginx:$Tag" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Reference in New Issue
Block a user