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