Local preservation snapshot, not a new deployment or simulation acceptance.
18 lines
1.4 KiB
PowerShell
18 lines
1.4 KiB
PowerShell
param([string]$Root = 'D:\NDC_MISSIONCORE\runtime\simulation')
|
|
$ErrorActionPreference = 'Continue'
|
|
$base = 'sha256:a4ba369f9d647c8d69c488d3066a64362277734cbe0533aa3ce7790c6cd63609'
|
|
$actual = docker image inspect 'ndc-ai-polygon-cmu:connectivity-v2' --format '{{.Id}}'
|
|
if ($LASTEXITCODE -ne 0 -or $actual.Trim() -ne $base) { throw 'Prepare the pinned connectivity-v2 CMU image first' }
|
|
$endpoint = docker context inspect --format '{{.Endpoints.docker.Host}}'
|
|
if ($LASTEXITCODE -ne 0) { throw 'Docker endpoint unavailable' }
|
|
$config = Join-Path $Root 'state\direction-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:direction-v1 -f (Join-Path $PSScriptRoot 'Dockerfile.direction') $PSScriptRoot
|
|
if ($LASTEXITCODE -ne 0) { throw 'Direction policy build failed' }
|
|
$image = docker --config $config --host $endpoint.Trim() image inspect ndc-ai-polygon-cmu:direction-v1 --format '{{.Id}}'
|
|
if ($LASTEXITCODE -ne 0) { throw 'Built image unavailable' }
|
|
@{base_image=$base; image=$image.Trim(); source_sha256=(Get-FileHash (Join-Path $PSScriptRoot 'patch_direction.py') -Algorithm SHA256).Hash.ToLower(); installed_at=[DateTime]::UtcNow.ToString('o')} | ConvertTo-Json
|