summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-01 07:58:04 +0000
committerGerrit Code Review <review@openstack.org>2019-02-01 07:58:04 +0000
commitb46ac3ea88d3cc11739986d753dec54148eda062 (patch)
tree397d959b31acd6e985d800da6ae1b523be7dde2a
parentee5d3853437d55cfe4f15d37a85a6e378f0a06a3 (diff)
parent0e50a2bb89525874c6f12b458356a5f6feff78c2 (diff)
Merge "Allow different filenames for Dockerfiles"
-rw-r--r--roles/build-docker-image/common.rst15
-rw-r--r--roles/build-docker-image/defaults/main.yaml1
-rw-r--r--roles/build-docker-image/tasks/main.yaml2
3 files changed, 17 insertions, 1 deletions
diff --git a/roles/build-docker-image/common.rst b/roles/build-docker-image/common.rst
index affb19f..95d37ad 100644
--- a/roles/build-docker-image/common.rst
+++ b/roles/build-docker-image/common.rst
@@ -42,6 +42,15 @@ using this role.
42 The project directory. Serves as the base for 42 The project directory. Serves as the base for
43 :zuul:rolevar:`build-docker-image.docker_images.context`. 43 :zuul:rolevar:`build-docker-image.docker_images.context`.
44 44
45.. zuul:rolevar:: docker_dockerfile
46 :default: Dockerfile
47
48 The default Dockerfile name to use. Serves as the base for
49 :zuul:rolevar:`build-docker-image.docker_images.dockerfile`.
50 This allows a global overriding of Dockerfile name, for example
51 when building all images from different folders with similarily
52 named dockerfiles.
53
45.. zuul:rolevar:: docker_credentials 54.. zuul:rolevar:: docker_credentials
46 :type: dict 55 :type: dict
47 56
@@ -75,6 +84,12 @@ using this role.
75 The docker build context; this should be a directory underneath 84 The docker build context; this should be a directory underneath
76 :zuul:rolevar:`build-docker-image.zuul_work_dir`. 85 :zuul:rolevar:`build-docker-image.zuul_work_dir`.
77 86
87 .. zuul:rolevar:: dockerfile
88
89 The filename of the dockerfile, present in the context folder,
90 used for building the image. Provide this if you are using
91 a non-standard filename for a specific image.
92
78 .. zuul:rolevar:: repository 93 .. zuul:rolevar:: repository
79 94
80 The name of the target repository in dockerhub for the 95 The name of the target repository in dockerhub for the
diff --git a/roles/build-docker-image/defaults/main.yaml b/roles/build-docker-image/defaults/main.yaml
index 9739eb1..d702500 100644
--- a/roles/build-docker-image/defaults/main.yaml
+++ b/roles/build-docker-image/defaults/main.yaml
@@ -1 +1,2 @@
1zuul_work_dir: "{{ zuul.project.src_dir }}" 1zuul_work_dir: "{{ zuul.project.src_dir }}"
2docker_dockerfile: "Dockerfile"
diff --git a/roles/build-docker-image/tasks/main.yaml b/roles/build-docker-image/tasks/main.yaml
index 5b8fe61..653dc54 100644
--- a/roles/build-docker-image/tasks/main.yaml
+++ b/roles/build-docker-image/tasks/main.yaml
@@ -1,6 +1,6 @@
1- name: Build a docker image 1- name: Build a docker image
2 command: >- 2 command: >-
3 docker build {{ item.path | default('.') }} -f Dockerfile 3 docker build {{ item.path | default('.') }} -f {{ item.dockerfile | default(docker_dockerfile) }}
4 {% if item.target | default(false) -%} 4 {% if item.target | default(false) -%}
5 --target {{ item.target }} 5 --target {{ item.target }}
6 {% endif -%} 6 {% endif -%}