recreate app containers when images are rebuilt
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
15
playbook.yml
15
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 }}"
|
||||
|
||||
Reference in New Issue
Block a user