param([string]$Root = 'D:\NDC_MISSIONCORE\runtime\simulation') $ErrorActionPreference = 'Stop' $base = 'sha256:12835df9ceb377257a7e99ccbbb37636eb67d989e9bf24df8cb530341acf0c3c' $docker = 'C:\Program Files\Docker\Docker\resources\bin\docker.exe' $actual = & $docker image inspect 'ndc-ai-polygon-cmu:dense-footprint-v1' --format '{{.Id}}' if ($LASTEXITCODE -ne 0 -or $actual.Trim() -ne $base) { throw 'Pinned dense-footprint-v1 image required' } $endpoint = & $docker context inspect --format '{{.Endpoints.docker.Host}}' if ($LASTEXITCODE -ne 0) { throw 'Docker endpoint unavailable' } $config = Join-Path $Root 'state\clearance-public-build' New-Item -ItemType Directory -Force $config | Out-Null [IO.File]::WriteAllText((Join-Path $config 'config.json'), '{"auths":{"https://index.docker.io/v1/":{}}}') $env:DOCKER_CONFIG = $config $env:BUILDX_CONFIG = Join-Path $config 'buildx' & $docker --config $config --host $endpoint.Trim() build --progress plain -t ndc-ai-polygon-cmu:clearance-v2 -f (Join-Path $PSScriptRoot 'Dockerfile.clearance') $PSScriptRoot if ($LASTEXITCODE -ne 0) { throw 'Clearance preference build failed' } $image = & $docker --config $config --host $endpoint.Trim() image inspect ndc-ai-polygon-cmu:clearance-v2 --format '{{.Id}}' if ($LASTEXITCODE -ne 0) { throw 'Built image unavailable' } @{base_image=$base; image=$image.Trim(); source_sha256=(Get-FileHash (Join-Path $PSScriptRoot 'patch_clearance_preference.py') -Algorithm SHA256).Hash.ToLower(); built_at=[DateTime]::UtcNow.ToString('o'); rollback_image=$base} | ConvertTo-Json