Add support for passing path to docker build
If we clone gerrit to ~/src/gerrit.googlesource.com/gerrit but want to keep the Dockerfile in system-config, then we need to be able to run: docker build ~/src/gerrit.googlesource.com/gerrit -f Dockerfile Most of the time the dir will just be '.', so put in a sensible default. Change-Id: I235080c05e679d2ac270cd5401b85c655fab3112
This commit is contained in:
parent
2cf0364d40
commit
700f195706
@ -63,6 +63,12 @@
|
|||||||
uploaded (it will be tagged with this in the local
|
uploaded (it will be tagged with this in the local
|
||||||
registry).
|
registry).
|
||||||
|
|
||||||
|
.. zuul:jobvar:: path
|
||||||
|
|
||||||
|
Optional; if supplied, the directory that should be passed to
|
||||||
|
docker build. Useful for building images with a Dockerfile
|
||||||
|
in the context directory but a source repository elsewhere.
|
||||||
|
|
||||||
abstract: true
|
abstract: true
|
||||||
pre-run: playbooks/zuul/build-image/pre.yaml
|
pre-run: playbooks/zuul/build-image/pre.yaml
|
||||||
run: playbooks/zuul/build-image/run.yaml
|
run: playbooks/zuul/build-image/run.yaml
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
tasks:
|
tasks:
|
||||||
- name: Build a docker image
|
- name: Build a docker image
|
||||||
command: "docker build . {{ target | default(false) | ternary('--target ', '') }}{{ target | default('') }} --tag {{ item.repository }}:change_{{ zuul.change }}"
|
command: "docker build {{ item.path | default('.') }} -f Dockerfile {{ target | default(false) | ternary('--target ', '') }}{{ target | default('') }} --tag {{ item.repository }}:change_{{ zuul.change }}"
|
||||||
args:
|
args:
|
||||||
chdir: "{{ zuul.project.src_dir }}/{{ item.context }}"
|
chdir: "{{ zuul.project.src_dir }}/{{ item.context }}"
|
||||||
loop: "{{ images }}"
|
loop: "{{ images }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user