zuul-jobs/roles/build-docker-image/tasks/main.yaml

17 lines
609 B
YAML

- name: Build a docker image
command: >-
docker build {{ item.path | default('.') }} -f {{ item.dockerfile | default(docker_dockerfile) }}
{% if item.target | default(false) -%}
--target {{ item.target }}
{% endif -%}
{% for build_arg in item.build_args | default([]) -%}
--build-arg {{ build_arg }}
{% endfor -%}
--tag {{ item.repository }}:change_{{ zuul.change }}
{% for tag in item.tags | default(['latest']) -%}
--tag {{ item.repository }}:{{ tag }}
{% endfor -%}
args:
chdir: "{{ zuul_work_dir }}/{{ item.context }}"
loop: "{{ docker_images }}"