- scripts/build-push.ps1: arm64 buildx bake + push, аналог build-push.sh для Windows-дева (ASCII). - deploy/pi/README: указать .ps1 для Windows и почему `bash ...` в PowerShell не работает. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
1.3 KiB
PowerShell
Executable File
27 lines
1.3 KiB
PowerShell
Executable File
# Build prod images (app + tunnel) for linux/arm64 (Raspberry Pi) and push to the registry.
|
|
# Run on the DEV machine with Docker Desktop / buildx. Registry and tag come from the root
|
|
# .env (IMAGE_REGISTRY / IMAGE_TAG) - the same values docker-compose.yml uses.
|
|
# Log in to the registry once before running: docker login gitea.arseniev.info
|
|
# Keep this file ASCII-only (Windows PowerShell 5.1 mangles non-ASCII without a BOM).
|
|
$ErrorActionPreference = "Stop"
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $root
|
|
|
|
# Builder with multi-arch push support (docker-container driver) - create if missing.
|
|
docker buildx inspect fsbuilder *> $null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
docker buildx create --name fsbuilder --driver docker-container | Out-Null
|
|
}
|
|
|
|
# arm64 emulation on an x86 host (usually already present in Docker Desktop; idempotent).
|
|
docker run --privileged --rm tonistiigi/binfmt --install arm64 | Out-Null
|
|
|
|
Write-Host "Building app+tunnel for linux/arm64 and pushing to the registry..." -ForegroundColor Green
|
|
docker buildx bake -f docker-compose.yml --builder fsbuilder --set "*.platform=linux/arm64" --push
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Build/push FAILED (exit $LASTEXITCODE)." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Done. On the Pi: docker compose pull && docker compose up -d" -ForegroundColor Green
|