[libvirt] [jenkins-ci PATCH 4/5] make: add a simple build target that generates all dockerfiles

Daniel P. Berrangé posted 5 patches 6 years, 11 months ago
[libvirt] [jenkins-ci PATCH 4/5] make: add a simple build target that generates all dockerfiles
Posted by Daniel P. Berrangé 6 years, 11 months ago
This is useful for local testing of docker changes, and can also be
called to rebuild the content needed for the libvirt-dockerfiles
repository.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 Makefile | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Makefile b/Makefile
index 1ba6b21..d2c89e9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,23 @@
 
+LCITOOL = guests/lcitool
+
+HOST_VARS = $(wildcard guests/host_vars/*/*.yml)
+PROJECT_VARS = $(wildcard guests/vars/projects/*.yml)
+
+all: dockerfiles
 
 syntax-check:
 	flake8 guests/lcitool
+
+.PHONY: dockerfiles
+
+DOCKERHOSTS=$(shell $(LCITOOL) hosts -d)
+
+build/dockerfiles/%.docker: Makefile $(LCITOOL) $(HOST_VARS) $(PROJECT_VARS)
+	mkdir -p build/dockerfiles
+	$(LCITOOL) dockerfile $* libvirt > $@
+
+dockerfiles: $(DOCKERHOSTS:%=build/dockerfiles/%.docker)
+
+clean:
+	rm -rf build/
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list