Recreate containers when a deploy rebuilds their image #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "redeploy-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes "sync and deploy doesn't pick up the new code".
Cause. The image was rebuilt. Only the early layers (e.g.
npm ci) came from cache, andCOPY . .and later steps ran again. But podman-compose recreates containers only when the compose file's own hash changes. After a code-only push, the old containers kept running the old image.Fix.
panelctl deploynow runscompose buildfirst. If a container's image ID no longer matches its tag, it runsup --force-recreate; otherwise it runs a plainup. The deployment log shows "Images changed, recreating the app's containers". A deploy with nothing changed leaves the containers alone.-p <app>. Before, the project name came from the compose file's directory, so every git app (stacks/<app>/repo/compose.yaml) was the projectrepo. That had three effects:--remove-orphanscould remove another git app's containers.repo_data). The manifest records that asAPP_COMPOSE_PROJECT, and panelctl then skips--remove-orphansso it can't touch other apps.Tested with real podman 5 and podman-compose 1.5.0 (the version the VPS uses), in a privileged container, using the real panelctl:
repo.repo. No app loses its containers.COPY . .onward, and the running container serves the new version.The 64 API checks pass, as does
nix flake check.🤖 Generated with Claude Code
https://claude.ai/code/session_01UbWSNkXxZhYf7eqHTyx3Bf