Files
wecom-ai-assistant/scripts/build-push-registry-667788.ps1
bujie9527 ed3a5c0486
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
Update registry to registry.667788.cool and add build scripts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 22:34:17 +08:00

69 lines
2.4 KiB
PowerShell
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.
# 构建并推送到 registry.667788.cool
# 用途:快速构建并推送镜像到指定 Registry
$RegistryUrl = "registry.667788.cool"
$Namespace = "wecom-ai"
$Tag = "latest"
Write-Host "=== 构建并推送到 registry.667788.cool ===" -ForegroundColor Cyan
Write-Host ""
# 检查是否需要登录
Write-Host "提示: 如果 Registry 需要认证,请先运行:" -ForegroundColor Yellow
Write-Host " docker login $RegistryUrl" -ForegroundColor Gray
Write-Host ""
# 构建 Backend 镜像
Write-Host "=== 构建 Backend 镜像 ===" -ForegroundColor Cyan
$backendImage = "${RegistryUrl}/${Namespace}/wecom-ai-backend:${Tag}"
Write-Host "镜像: $backendImage" -ForegroundColor Gray
Write-Host "构建中..." -ForegroundColor Yellow
docker build -f deploy/docker/backend.Dockerfile -t $backendImage .
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Backend 构建失败" -ForegroundColor Red
Write-Host "提示: 如果无法连接 Docker Hub请配置 Docker 镜像加速" -ForegroundColor Yellow
Write-Host "参考: docs/docker-mirror.md" -ForegroundColor Gray
exit 1
}
Write-Host "✓ Backend 构建成功" -ForegroundColor Green
Write-Host "推送中..." -ForegroundColor Yellow
docker push $backendImage
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Backend 推送失败" -ForegroundColor Red
Write-Host "提示: 请检查 Registry 是否需要登录" -ForegroundColor Yellow
exit 1
}
Write-Host "✓ Backend 推送成功" -ForegroundColor Green
Write-Host ""
# 构建 Admin 镜像
Write-Host "=== 构建 Admin 镜像 ===" -ForegroundColor Cyan
$adminImage = "${RegistryUrl}/${Namespace}/wecom-ai-admin:${Tag}"
Write-Host "镜像: $adminImage" -ForegroundColor Gray
Write-Host "构建中..." -ForegroundColor Yellow
docker build -f deploy/docker/admin.Dockerfile -t $adminImage .
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Admin 构建失败" -ForegroundColor Red
exit 1
}
Write-Host "✓ Admin 构建成功" -ForegroundColor Green
Write-Host "推送中..." -ForegroundColor Yellow
docker push $adminImage
if ($LASTEXITCODE -ne 0) {
Write-Host "✗ Admin 推送失败" -ForegroundColor Red
exit 1
}
Write-Host "✓ Admin 推送成功" -ForegroundColor Green
Write-Host ""
Write-Host "=== 完成 ===" -ForegroundColor Green
Write-Host ""
Write-Host "镜像已推送到:" -ForegroundColor Cyan
Write-Host " - $backendImage" -ForegroundColor Gray
Write-Host " - $adminImage" -ForegroundColor Gray
Write-Host ""