Merge "Allow different filenames for Dockerfiles"

This commit is contained in:
Zuul 2019-02-01 07:58:04 +00:00 committed by Gerrit Code Review
commit b46ac3ea88
3 changed files with 17 additions and 1 deletions

View File

@ -42,6 +42,15 @@ using this role.
The project directory. Serves as the base for
:zuul:rolevar:`build-docker-image.docker_images.context`.
.. zuul:rolevar:: docker_dockerfile
:default: Dockerfile
The default Dockerfile name to use. Serves as the base for
:zuul:rolevar:`build-docker-image.docker_images.dockerfile`.
This allows a global overriding of Dockerfile name, for example
when building all images from different folders with similarily
named dockerfiles.
.. zuul:rolevar:: docker_credentials
:type: dict
@ -75,6 +84,12 @@ using this role.
The docker build context; this should be a directory underneath
:zuul:rolevar:`build-docker-image.zuul_work_dir`.
.. zuul:rolevar:: dockerfile
The filename of the dockerfile, present in the context folder,
used for building the image. Provide this if you are using
a non-standard filename for a specific image.
.. zuul:rolevar:: repository
The name of the target repository in dockerhub for the

View File

@ -1 +1,2 @@
zuul_work_dir: "{{ zuul.project.src_dir }}"
docker_dockerfile: "Dockerfile"

View File

@ -1,6 +1,6 @@
- name: Build a docker image
command: >-
docker build {{ item.path | default('.') }} -f Dockerfile
docker build {{ item.path | default('.') }} -f {{ item.dockerfile | default(docker_dockerfile) }}
{% if item.target | default(false) -%}
--target {{ item.target }}
{% endif -%}