BAI-29: add Docker deployment

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
GSC-CODEX
2026-08-07 09:43:34 +08:00
co-authored by multica-agent
parent 24d645b77c
commit cf082d04e4
9 changed files with 187 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
param(
[ValidateRange(1, 65535)]
[int]$Port = 4173
)
$ErrorActionPreference = "Stop"
docker compose version | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Docker Compose is not available."
}
docker info | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "Docker is not running."
}
$env:APP_PORT = $Port.ToString()
docker compose up --build --detach
if ($LASTEXITCODE -ne 0) {
throw "Docker Compose failed to start the application."
}
$containerId = (docker compose ps --quiet app).Trim()
if (-not $containerId) {
throw "The application container was not created."
}
for ($attempt = 0; $attempt -lt 60; $attempt++) {
$state = docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' $containerId
if ($state -eq "healthy") {
Write-Host "Application is ready: http://localhost:$Port"
exit 0
}
if ($state -eq "unhealthy" -or $state -eq "exited" -or $state -eq "dead") {
docker compose logs --no-color --tail 100 app
throw "The application container entered state: $state"
}
Start-Sleep -Seconds 1
}
docker compose logs --no-color --tail 100 app
throw "Timed out waiting for the application health check."