# 构建并推送到 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 ""