Browse code

Update Makefile for docker support

Change-Id: I7a9cb4977da7926c080f01e0cdfa128478162cba
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/8948
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Priyesh Padmavilasom <ppadmavilasom@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Satya Naga Rajesh Vasamsetty authored on 2020/01/21 17:25:31
Showing 1 changed files
... ...
@@ -95,6 +95,9 @@ else
95 95
 VIXDISKUTIL :=
96 96
 endif
97 97
 
98
+#marker file indicating if run from container
99
+DOCKER_ENV=/.dockerenv
100
+
98 101
 $(TOOLS_BIN):
99 102
 	mkdir -p $(TOOLS_BIN)
100 103
 
... ...
@@ -552,13 +555,19 @@ clean-chroot:
552 552
 check-tools: check-bison check-g++ check-gawk check-repo-tool check-texinfo check-sanity check-docker check-pyopenssl
553 553
 
554 554
 check-docker:
555
+ifeq (,$(wildcard $(DOCKER_ENV)))
555 556
 	@command -v docker >/dev/null 2>&1 || { echo "Package docker not installed. Aborting." >&2; exit 1; }
557
+endif
556 558
 
557 559
 check-docker-service:
560
+ifeq (,$(wildcard $(DOCKER_ENV)))
558 561
 	@docker ps >/dev/null 2>&1 || { echo "Docker service is not running. Aborting." >&2; exit 1; }
562
+endif
559 563
 
560 564
 check-docker-py:
565
+ifeq (,$(wildcard $(DOCKER_ENV)))
561 566
 	@python3 -c "import docker; assert docker.__version__ >= '$(PHOTON_DOCKER_PY_VER)'" >/dev/null 2>&1 || { echo "Error: Python3 package docker-py3 $(PHOTON_DOCKER_PY_VER) not installed.\nPlease use: pip3 install docker==$(PHOTON_DOCKER_PY_VER)" >&2; exit 1; }
567
+endif
562 568
 
563 569
 check-pyopenssl:
564 570
 	@python3 -c "import OpenSSL" > /dev/null 2>&1 || { echo "Error pyOpenSSL package not installed.\nPlease use: pip3 install pyOpenSSL" >&2; exit 1; }