Browse Source

Merge "Allow different filenames for Dockerfiles"

changes/48/633948/4
Zuul 5 months ago
parent
commit
b46ac3ea88

+ 15
- 0
roles/build-docker-image/common.rst View File

@@ -42,6 +42,15 @@ using this role.
42 42
    The project directory.  Serves as the base for
43 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 54
 .. zuul:rolevar:: docker_credentials
46 55
    :type: dict
47 56
 
@@ -75,6 +84,12 @@ using this role.
75 84
       The docker build context; this should be a directory underneath
76 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 93
    .. zuul:rolevar:: repository
79 94
 
80 95
       The name of the target repository in dockerhub for the

+ 1
- 0
roles/build-docker-image/defaults/main.yaml View File

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

+ 1
- 1
roles/build-docker-image/tasks/main.yaml View File

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

Loading…
Cancel
Save