27 lines
874 B
PowerShell
27 lines
874 B
PowerShell
param(
|
|
[Parameter(Mandatory = $true)][string]$Registry,
|
|
[Parameter(Mandatory = $true)][string]$Namespace,
|
|
[string]$Repository = "mini-openclaw",
|
|
[string]$Tag = ""
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
|
if (-not $Tag) {
|
|
$Tag = (git -C $root rev-parse --short HEAD).Trim()
|
|
}
|
|
if ($Registry -notmatch "\.aliyuncs\.com$") {
|
|
throw "Registry must be an Alibaba Cloud ACR domain ending in .aliyuncs.com"
|
|
}
|
|
$image = "$Registry/$Namespace/$Repository`:$Tag"
|
|
|
|
python (Join-Path $root "scripts/verify.py")
|
|
if ($LASTEXITCODE -ne 0) { throw "Verification failed; image was not published" }
|
|
|
|
docker build --pull -t $image $root
|
|
if ($LASTEXITCODE -ne 0) { throw "Docker build failed" }
|
|
docker push $image
|
|
if ($LASTEXITCODE -ne 0) { throw "Docker push failed" }
|
|
|
|
Write-Output "Published immutable image: $image"
|