param([string]$Root = 'D:\NDC_MISSIONCORE\runtime\simulation') $ErrorActionPreference = 'Stop' $base = 'sha256:422fdf745e4ba6d5c722422c47a48483a85fe2f952f3a506411f832bded7bba2' $docker = 'C:\Program Files\Docker\Docker\resources\bin\docker.exe' $actual = & $docker image inspect 'ndc-ai-polygon-cmu:support-v1' --format '{{.Id}}' if ($LASTEXITCODE -ne 0 -or $actual.Trim() -ne $base) { throw 'Pinned support-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-refinement-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-v3 -f (Join-Path $PSScriptRoot 'Dockerfile.clearance-refinement') $PSScriptRoot if ($LASTEXITCODE -ne 0) { throw 'Support kernel build failed' } $image = & $docker --config $config --host $endpoint.Trim() image inspect ndc-ai-polygon-cmu:clearance-v3 --format '{{.Id}}' if ($LASTEXITCODE -ne 0) { throw 'Built image unavailable' } @{base_image=$base; image=$image.Trim(); source_sha256=(Get-FileHash (Join-Path $PSScriptRoot 'missioncore_clearance.hpp') -Algorithm SHA256).Hash.ToLower(); built_at=[DateTime]::UtcNow.ToString('o'); rollback_image=$base} | ConvertTo-Json