From 51cd47bd47e7ff04407a7e105272aca91f62bfbd Mon Sep 17 00:00:00 2001 From: boxswapper Date: Thu, 12 Nov 2026 12:07:15 -0700 Subject: [PATCH] recreate app containers when images are rebuilt Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- playbook.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/playbook.yml b/playbook.yml index b52731e..caa90c1 100644 --- a/playbook.yml +++ b/playbook.yml @@ -60,17 +60,6 @@ {{ playbook_dir }}/trade-hub/frontend when: frontend_image_check.rc != 0 or force_rebuild | bool - # podman_container does not recreate a container whose image tag now - # resolves to a new ID, so rebuilt images require removing them first. - - name: Remove containers so rebuilt images are used - containers.podman.podman_container: - name: "{{ item }}" - state: absent - loop: - - sc-inventory-backend - - sc-inventory-frontend - when: force_rebuild | bool - - name: Create podman network containers.podman.podman_network: name: "{{ network_name }}" @@ -102,6 +91,9 @@ name: sc-inventory-backend image: "{{ backend_image }}:{{ image_tag }}" state: started + # podman does not recreate a container when its image tag resolves to + # a new ID, so without this a rebuilt image would be ignored. + recreate: true network: "{{ network_name }}" # Network alias "backend" matches the compose service name, so the # nginx upstream (http://backend:8000) resolves in both deployments. @@ -118,6 +110,7 @@ name: sc-inventory-frontend image: "{{ frontend_image }}:{{ image_tag }}" state: started + recreate: true network: "{{ network_name }}" ports: - "{{ frontend_port }}"