VOL-1554 Updated build to use LOCAL_PROTO for using local protos, and using a single base dockerfile
Change-Id: Ifa4ec6094c260a604918ccee75420bf328e647dd
diff --git a/python/Makefile b/python/Makefile
index 4799a78..1cb11de 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -43,6 +43,10 @@
--rm --force-rm \
$(DOCKER_BUILD_EXTRA_ARGS)
+DOCKER_BUILD_EXTRA_ARGS = \
+ --build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+ --build-arg LOCAL_PROTOS=$(LOCAL_PROTOS)
+
DOCKER_IMAGE_LIST = \
voltha-openolt-adapter-base \
voltha-openolt-adapter
@@ -75,15 +79,17 @@
containers: base openolt_adapter
base:
+ mkdir -p local_imports/
ifdef LOCAL_PYVOLTHA
- mkdir -p pyvoltha/dist
- cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
- mkdir -p voltha-protos/dist
- cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
- docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base_local .
-else
- docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base .
+ mkdir -p local_imports/pyvoltha/dist
+ cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
endif
+ifdef LOCAL_PROTOS
+ mkdir -p local_imports/voltha-protos/dist
+ cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+endif
+ docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base .
+
openolt_adapter: base
docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter:${TAG} -f docker/Dockerfile.openolt_adapter .
@@ -104,8 +110,7 @@
docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG}
clean:
- rm -rf pyvoltha
- rm -rf voltha-protos
+ rm -rf local_imports
find . -name '*.pyc' | xargs rm -f
distclean: clean
@@ -133,13 +138,16 @@
fi
ifdef LOCAL_PYVOLTHA
- mkdir -p pyvoltha/dist
- cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
- mkdir -p voltha-protos/dist
- cp ../../voltha-protos/dist/*.tar.gz voltha-protos/dist/
+ mkdir -p local_imports/pyvoltha/dist
+ cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
. ${VENVDIR}/bin/activate && \
- pip install pyvoltha/dist/*.tar.gz && \
- pip install voltha-protos/dist/*.tar.gz
+ pip install local_imports/pyvoltha/dist/*.tar.gz
+endif
+ifdef LOCAL_PROTOS
+ mkdir -p local_imports/voltha-protos/dist
+ cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+ . ${VENVDIR}/bin/activate && \
+ pip install local_imports/voltha-protos/dist/*.tar.gz
endif
# end file