35 lines
2.0 KiB
PowerShell
35 lines
2.0 KiB
PowerShell
param([string]$Root = 'D:\NDC_MISSIONCORE\runtime\simulation')
|
|
# Windows PowerShell 5 treats Docker's normal stderr progress as ErrorRecords.
|
|
# Native failures are checked by exit code after each command below.
|
|
$ErrorActionPreference = 'Continue'
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
$tag = 'ndc/mission-core-ai-module-cmu-navigation:158e67b3-v1'
|
|
$receipt = Join-Path $Root 'assets\cmu-navigation-v1.json'
|
|
$existing = docker image inspect $tag --format '{{.Id}}' 2>$null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
# Public upstream images need no credentials. Windows SSH cannot access the
|
|
# interactive user's credential helper; isolate only this build's config.
|
|
$endpoint = docker context inspect --format '{{.Endpoints.docker.Host}}'
|
|
if ($LASTEXITCODE -ne 0) { throw 'Docker endpoint unavailable' }
|
|
$buildConfig = Join-Path $PSScriptRoot 'public-build-config'
|
|
New-Item -ItemType Directory -Force $buildConfig | Out-Null
|
|
# An explicit anonymous registry prevents CLI auto-discovery of wincred.
|
|
[IO.File]::WriteAllText((Join-Path $buildConfig 'config.json'), '{"auths":{"https://index.docker.io/v1/":{}}}')
|
|
$env:DOCKER_CONFIG = $buildConfig
|
|
$env:BUILDX_CONFIG = Join-Path $buildConfig 'buildx'
|
|
docker --config $buildConfig --host $endpoint.Trim() build --progress plain -t $tag -f (Join-Path $PSScriptRoot 'Dockerfile') $PSScriptRoot
|
|
if ($LASTEXITCODE -ne 0) { throw 'CMU navigation image build failed' }
|
|
$existing = docker image inspect $tag --format '{{.Id}}'
|
|
if ($LASTEXITCODE -ne 0) { throw 'Built navigation image is unavailable' }
|
|
}
|
|
$value = @{
|
|
schema_version = 'missioncore.ai-polygon-navigation-install/v1'
|
|
upstream = 'HongbiaoZ/autonomous_exploration_development_environment'
|
|
upstream_commit = '158e67b31b644ed1e8b06eb1d7f70e183cc62591'
|
|
image = $existing.Trim()
|
|
tag = $tag
|
|
installed_at = [DateTime]::UtcNow.ToString('o')
|
|
}
|
|
[IO.File]::WriteAllText($receipt, ($value | ConvertTo-Json -Depth 5), [Text.UTF8Encoding]::new($false))
|
|
$value | ConvertTo-Json -Compress
|