Files
Art-gallery/infra/docker/build-push-lan.ps1
T
Danila KhodjaefandCursor 21e3e41e48 Add one-command dev-to-prod release with clear SUCCESS/FAILED banners.
Introduce devtoprod:release orchestrator, config file, CLI result footers on deploy scripts, auto-thumb regeneration on curator fixes, and updated deploy documentation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 14:54:56 +03:00

48 lines
1.6 KiB
PowerShell

# Build and push the production web image to Gitea over LAN (fast path).
param(
[string]$Tag = "latest",
[switch]$SkipHosts,
[switch]$SkipBuild
)
$ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot "..\scripts\lib\Deploy-CliResult.ps1")
$Registry = "gitea.mysuperlab.netcraze.pro"
$Image = "$Registry/danilka/gallery-web"
function Test-DockerRunning {
docker info 2>&1 | Out-Null
return $LASTEXITCODE -eq 0
}
Write-Host "=== Build + LAN push to Gitea ===" -ForegroundColor Cyan
if (-not (Test-DockerRunning)) {
Write-DeployCliResult -Script 'build-push-lan' -Success $false -Summary 'Docker is not running. Start Docker Desktop and retry.'
exit 1
}
if (-not $SkipBuild) {
Write-Host ""
Write-Host "Building ${Image}:${Tag} ..."
docker build -f infra/docker/Dockerfile -t "${Image}:${Tag}" .
if ($LASTEXITCODE -ne 0) {
Write-DeployCliResult -Script 'build-push-lan' -Success $false -Summary "Docker build failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "Build complete." -ForegroundColor Green
} else {
Write-Host "Skipping build (-SkipBuild)." -ForegroundColor Yellow
}
Write-Host ""
& "$PSScriptRoot/push-lan.ps1" -Tag $Tag -SkipHosts:$SkipHosts
if ($LASTEXITCODE -ne 0) {
Write-DeployCliResult -Script 'build-push-lan' -Success $false -Summary "Docker push failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-DeployCliResult -Script 'build-push-lan' -Success $true -Summary 'Docker image built and pushed to Gitea.' -Details @("Image: ${Image}:${Tag}")
exit 0