fix: defer podman system migrate to after the build to eliminate early downtime

podman system migrate was stopping all containers immediately (visible in
the terminal output as "stopped <id>" lines), before the build even began.

Moving it to just before compose down/up means running containers stay
alive for the entire duration of the image build.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
This commit is contained in:
Claude 2026-03-24 10:48:45 +00:00
parent a16ccdcef4
commit 031c3bdd41
No known key found for this signature in database

View file

@ -127,8 +127,8 @@ fi
if ! grep -q "^${_HIY_USER}:" /etc/subgid 2>/dev/null; then if ! grep -q "^${_HIY_USER}:" /etc/subgid 2>/dev/null; then
echo "${_HIY_USER}:100000:65536" | sudo tee -a /etc/subgid > /dev/null echo "${_HIY_USER}:100000:65536" | sudo tee -a /etc/subgid > /dev/null
fi fi
# Migrate storage so Podman picks up the current subuid/subgid mappings. # NOTE: podman system migrate is intentionally deferred until just before
podman system migrate # compose up so that running containers stay alive during the image build.
# ── Allow rootless processes to bind ports 80/443 ───────────────────────────── # ── Allow rootless processes to bind ports 80/443 ─────────────────────────────
# Rootless Podman cannot bind privileged ports (<1024) by default. # Rootless Podman cannot bind privileged ports (<1024) by default.
@ -181,5 +181,8 @@ done
make -C "$SCRIPT_DIR" build make -C "$SCRIPT_DIR" build
# ── Swap to new images (brief downtime starts here) ──────────────────────────── # ── Swap to new images (brief downtime starts here) ────────────────────────────
# Migrate Podman storage to pick up current subuid/subgid mappings.
# Doing this here (not earlier) keeps running containers alive during the build.
podman system migrate
podman compose --env-file "$REPO_ROOT/.env" -f "$SCRIPT_DIR/docker-compose.yml" down podman compose --env-file "$REPO_ROOT/.env" -f "$SCRIPT_DIR/docker-compose.yml" down
podman compose --env-file "$REPO_ROOT/.env" -f "$SCRIPT_DIR/docker-compose.yml" up -d podman compose --env-file "$REPO_ROOT/.env" -f "$SCRIPT_DIR/docker-compose.yml" up -d