Skip to content

Commit 9abc559

Browse files
authored
Merge pull request #530 from NHSDigital/APIM-Pipeline-fix
Updated the ansible playbook to use the navtive docker cli commands
2 parents 4dd1844 + 108396a commit 9abc559

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

ansible/roles/build-ecs-proxies/tasks/build-container.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@
1010
changed_when: no
1111

1212
- name: pull latest if exists - to ensure cache {{ item }}
13-
docker_image:
14-
name: "{{ ecr_registry }}/{{ item }}:{{ describe_images.stdout }}"
15-
source: pull
13+
ansible.builtin.command:
14+
cmd: "docker pull {{ ecr_registry }}/{{ item }}:{{ describe_images.stdout }}"
1615
when: describe_images.stdout != 'None'
1716
ignore_errors: true
1817
no_log: true
1918

20-
- name: build and push ecr image {{ item }}
21-
docker_image:
22-
name: "{{ image_name }}"
23-
build:
24-
path: "{{ base_dir }}/{{ images_map[item].path }}"
25-
dockerfile: "{{ base_dir }}/{{ images_map[item].dockerfile }}"
26-
pull: yes
27-
network: host
28-
source: build
29-
force_source: yes
30-
push: yes
31-
timeout: 300
19+
- name: build ecr image {{ item }}
20+
ansible.builtin.command:
21+
cmd: >
22+
docker build
23+
-t {{ image_name }}
24+
-f {{ base_dir }}/{{ images_map[item].dockerfile }}
25+
{{ base_dir }}/{{ images_map[item].path }}
26+
--network host --pull
27+
register: build_result
28+
ignore_errors: false
29+
30+
- name: push ecr image {{ item }}
31+
ansible.builtin.command:
32+
cmd: "docker push {{ image_name }}"
33+
when: build_result.rc == 0

0 commit comments

Comments
 (0)