Деплой: PowerShell-версия build-push (на Windows bash уходит в WSL и падает)
- 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>
This commit is contained in:
+4
-2
@@ -37,9 +37,11 @@ VPS_TUNNEL_USER=tunnel
|
|||||||
(см. `IMAGE_REGISTRY`/`IMAGE_TAG` в `.env`). Pi 4/5 — мощный, но реестр держим как основной путь.
|
(см. `IMAGE_REGISTRY`/`IMAGE_TAG` в `.env`). Pi 4/5 — мощный, но реестр держим как основной путь.
|
||||||
|
|
||||||
На ПК (Docker Desktop) — один раз `docker login gitea.arseniev.info`, далее при каждом релизе:
|
На ПК (Docker Desktop) — один раз `docker login gitea.arseniev.info`, далее при каждом релизе:
|
||||||
```bash
|
```powershell
|
||||||
scripts/build-push.sh # buildx: arm64-сборка app+tunnel и push в реестр
|
.\scripts\build-push.ps1 # Windows (PowerShell); на *nix — bash scripts/build-push.sh
|
||||||
```
|
```
|
||||||
|
> `bash scripts/build-push.sh` в PowerShell уходит в WSL и падает, если нет дистрибутива —
|
||||||
|
> используй `.ps1`. Команды внутри — обычный `docker buildx`, работают и напрямую в PowerShell.
|
||||||
На Pi:
|
На Pi:
|
||||||
```bash
|
```bash
|
||||||
docker login gitea.arseniev.info # один раз (доступ к пакету)
|
docker login gitea.arseniev.info # один раз (доступ к пакету)
|
||||||
|
|||||||
Executable
+26
@@ -0,0 +1,26 @@
|
|||||||
|
# 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
|
||||||
Reference in New Issue
Block a user