VOL-1613: Redo Makefile and Dockerfile to new standard

Needed for proper releases

Also update system-test compose and docs needed to
run images using new build.

Change-Id: Idc00317de476fe943ec937977bf863a46c1e8305
diff --git a/python/Makefile b/python/Makefile
index 4fa911e..4fd5fe2 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -14,227 +14,153 @@
 # limitations under the License.
 #
 
-ifneq ($(VOLTHA_BUILD),docker)
-ifeq ($(VOLTHA_BASE)_set,_set)
-$(error To get started, please source the env.sh file)
-endif
+# set default shell
+SHELL = bash -e -o pipefail
+
+# Variables
+VERSION                  ?= $(shell cat ../VERSION)
+
+## Docker related
+DOCKER_REGISTRY          ?=
+DOCKER_REPOSITORY        ?=
+DOCKER_BUILD_ARGS        ?=
+DOCKER_TAG               ?= ${VERSION}
+OFAGENT_IMAGENAME        := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-ofagent:${DOCKER_TAG}
+CLI_IMAGENAME            := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-cli:${DOCKER_TAG}
+PONSIMOLT_IMAGENAME      := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-adapter-ponsim-olt:${DOCKER_TAG}
+PONSIMONU_IMAGENAME      := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-adapter-ponsim-onu:${DOCKER_TAG}
+
+## Docker labels. Only set ref and commit date if committed
+DOCKER_LABEL_VCS_URL     ?= $(shell git remote get-url $(shell git remote))
+DOCKER_LABEL_BUILD_DATE  ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
+DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD)
+
+ifeq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0)
+  DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)
+else
+  DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty
 endif
 
-ifeq ($(TAG),)
-TAG := latest
-endif
-
-ifeq ($(TARGET_TAG),)
-TARGET_TAG := latest
-endif
-
-# If no DOCKER_HOST_IP is specified grab a v4 IP address associated with
-# the default gateway
-ifeq ($(DOCKER_HOST_IP),)
-DOCKER_HOST_IP := $(shell ifconfig $$(netstat -rn | grep -E '^(default|0.0.0.0)' | head -1 | awk '{print $$NF}') | grep inet | awk '{print $$2}' | sed -e 's/addr://g')
-endif
-
-ifneq ($(http_proxy)$(https_proxy),)
-# Include proxies from the environment
-DOCKER_PROXY_ARGS = \
-       --build-arg http_proxy=$(http_proxy) \
-       --build-arg https_proxy=$(https_proxy) \
-       --build-arg ftp_proxy=$(ftp_proxy) \
-       --build-arg no_proxy=$(no_proxy) \
-       --build-arg HTTP_PROXY=$(HTTP_PROXY) \
-       --build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
-       --build-arg FTP_PROXY=$(FTP_PROXY) \
-       --build-arg NO_PROXY=$(NO_PROXY)
-endif
-
-DOCKER_BUILD_ARGS = \
-	--build-arg TAG=$(TAG) \
-	--build-arg REGISTRY=$(REGISTRY) \
-	--build-arg REPOSITORY=$(REPOSITORY) \
-	$(DOCKER_PROXY_ARGS) $(DOCKER_CACHE_ARG) \
-	 --rm --force-rm \
-	$(DOCKER_BUILD_EXTRA_ARGS)
-
-DOCKER_BUILD_EXTRA_ARGS = \
-	--build-arg LOCAL_PYVOLTHA=${LOCAL_PYVOLTHA} \
-	--build-arg LOCAL_PROTOS=${LOCAL_PROTOS}
-
-VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]')
-
-DOCKER_IMAGE_LIST = \
-	base \
-	adapter-ponsim-olt \
-	adapter-ponsim-onu
-
-# The following list was scavanged from the compose / stack files as well as
-# from the Dockerfiles. If nothing else it highlights that VOLTHA is not
-# using consistent versions for some of the containers.
-
-FETCH_BUILD_IMAGE_LIST = \
-       alpine:3.6 \
-       centos:7 \
-       centurylink/ca-certs:latest \
-       grpc/python:latest \
-       ubuntu:xenial
-
-FETCH_COMPOSE_IMAGE_LIST = \
-        wurstmeister/kafka:latest \
-        wurstmeister/zookeeper:latest
-
-# find k8s -type f | xargs grep image: | awk '{print $NF}' | sed -e 's/\"//g' | sed '/:.*$/!s/$/:latest/g' | sort -u | sed -e 's/^/       /g' -e 's/$/ \\/g'
-# Manually remove some image from this list as they don't reflect the new 
-# naming conventions for the VOLTHA build
-FETCH_K8S_IMAGE_LIST = \
-       wurstmeister/kafka:1.0.0 \
-       zookeeper:3.4.11
-
-FETCH_IMAGE_LIST = $(shell echo $(FETCH_BUILD_IMAGE_LIST) $(FETCH_COMPOSE_IMAGE_LIST) $(FETCH_K8S_IMAGE_LIST) | tr ' ' '\n' | sort -u)
-
-.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 base ponsim_olt ponsim_onu protos cli ofagent kafka common start stop tag push pull
+.PHONY: venv ofagent cli adapter_ponsim_olt adapter_ponsim_onu local-protos local-pyvoltha
 
 # This should to be the first and default target in this Makefile
 help:
 	@echo "Usage: make [<target>]"
 	@echo "where available targets are:"
 	@echo
-	@echo "build        : Build the Adapters protos and docker images.\n\
-               If this is the first time you are building, choose \"make build\" option."
-	@echo "clean        : Remove files created by the build and tests"
-	@echo "distclean    : Remove venv directory"
-	@echo "fetch        : Pre-fetch artifacts for subsequent local builds"
-	@echo "help         : Print this help"
-	@echo "rebuild-venv : Rebuild local Python virtualenv from scratch"
-	@echo "venv         : Build local Python virtualenv if did not exist yet"
-	@echo "containers   : Build all the docker containers"
-	@echo "base         : Build the base docker container used by all other dockers"
-	@echo "adapter_ponsim_olt       : Build the ponsim olt adapter docker container"
-	@echo "adapter_ponsim_onu       : Build the ponsim olt adapter docker container"
-	@echo "ofagent      : Build the openflow agent docker container"
-	@echo "tag          : Tag a set of images"
-	@echo "push         : Push the docker images to an external repository"
-	@echo "pull         : Pull the docker images from a repository"
+	@echo "build                : Build all docker images"
+	@echo "                         - If this is the first time you are building, choose 'make build' option."
+	@echo "help                 : Print this help"
+	@echo "ofagent              : Build the openflow agent docker image"
+	@echo "cli                  : Build the voltha CLI docker image"
+	@echo "adapter_ponsim_olt   : Build the ponsim olt adapter docker image"
+	@echo "adapter_ponsim_onu   : Build the ponsim onu adapter docker image"
+	@echo "docker-push   : Push the docker images to an external repository"
+	@echo "venv                 : Build local Python virtualenv"
+	@echo "clean                : Remove files created by the build and tests"
+	@echo "distclean            : Remove venv directory"
 	@echo
 
-## New directories can be added here
-#DIRS:=
 
-## If one directory depends on another directory that
-## dependency can be expressed here
-##
-## For example, if the Tibit directory depended on the eoam
-## directory being built first, then that can be expressed here.
-##  driver/tibit: eoam
+## Docker targets
 
-# Parallel Build
-$(DIRS):
-	@echo "    MK $@"
-	$(Q)$(MAKE) -C $@
+build: docker-build
 
-# Parallel Clean
-DIRS_CLEAN = $(addsuffix .clean,$(DIRS))
-$(DIRS_CLEAN):
-	@echo "    CLEAN $(basename $@)"
-	$(Q)$(MAKE) -C $(basename $@) clean
+docker-build: ofagent cli adapter_ponsim_olt adapter_ponsim_onu
 
-# Parallel Flake8
-DIRS_FLAKE8 = $(addsuffix .flake8,$(DIRS))
-$(DIRS_FLAKE8):
-	@echo "    FLAKE8 $(basename $@)"
-	-$(Q)$(MAKE) -C $(basename $@) flake8
+local-protos:
+	mkdir -p local_imports
+ifdef LOCAL_PROTOS
+	mkdir -p local_imports/voltha-protos/dist
+	cp ../../voltha-protos/dist/*.tar.gz local_imports/voltha-protos/dist/
+endif
 
-build: containers
-
-containers: base adapter_ponsim_olt adapter_ponsim_onu ofagent cli
-
-base:
+local-pyvoltha:
 	mkdir -p local_imports
 ifdef LOCAL_PYVOLTHA
 	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/
+
+ofagent: local-protos local-pyvoltha
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${OFAGENT_IMAGENAME} \
+    --build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+    --build-arg LOCAL_PROTOS=$(LOCAL_PROTOS) \
+    --build-arg org_label_schema_version="${VERSION}" \
+    --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
+    --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
+    --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
+    --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
+    -f docker/Dockerfile.ofagent .
+
+cli: local-protos local-pyvoltha
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${CLI_IMAGENAME} \
+    --build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+    --build-arg LOCAL_PROTOS=$(LOCAL_PROTOS) \
+    --build-arg org_label_schema_version="${VERSION}" \
+    --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
+    --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
+    --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
+    --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
+    -f docker/Dockerfile.cli .
+
+adapter_ponsim_olt: local-protos local-pyvoltha
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${PONSIMOLT_IMAGENAME} \
+    --build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+    --build-arg LOCAL_PROTOS=$(LOCAL_PROTOS) \
+    --build-arg org_label_schema_version="${VERSION}" \
+    --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
+    --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
+    --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
+    --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
+    -f docker/Dockerfile.adapter_ponsim_olt .
+
+adapter_ponsim_onu: local-protos local-pyvoltha
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${PONSIMONU_IMAGENAME} \
+    --build-arg LOCAL_PYVOLTHA=$(LOCAL_PYVOLTHA) \
+    --build-arg LOCAL_PROTOS=$(LOCAL_PROTOS) \
+    --build-arg org_label_schema_version="${VERSION}" \
+    --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
+    --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
+    --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
+    --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
+    -f docker/Dockerfile.adapter_ponsim_onu .
+
+docker-push:
+	docker push ${OFAGENT_IMAGENAME}
+	docker push ${CLI_IMAGENAME}
+	docker push ${PONSIMOLT_IMAGENAME}
+	docker push ${PONSIMONU_IMAGENAME}
+
+
+## Python venv dev environment
+
+VENVDIR := venv-volthago
+
+venv: distclean local-protos local-pyvoltha
+	virtualenv ${VENVDIR};\
+        source ./${VENVDIR}/bin/activate ; set -u ;\
+	rm ${VENVDIR}/local/bin ${VENVDIR}/local/lib ${VENVDIR}/local/include ;\
+        pip install -r requirements.txt
+
+ifdef LOCAL_PYVOLTHA
+	source ./${VENVDIR}/bin/activate ; set -u ;\
+	pip install local_imports/pyvoltha/dist/*.tar.gz
 endif
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-base:${TAG} -f docker/Dockerfile.base .
-
-
-adapter_ponsim_olt:
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-ponsim-olt:${TAG} -f docker/Dockerfile.adapter_ponsim_olt .
-
-adapter_ponsim_onu:
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-adapter-ponsim-onu:${TAG} -f docker/Dockerfile.adapter_ponsim_onu .
-
-ofagent:
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-ofagent:${TAG} -f docker/Dockerfile.ofagent .
-
-cli:
-	docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-cli:${TAG} -f docker/Dockerfile.cli .
-
-tag: $(patsubst  %,%.tag,$(DOCKER_IMAGE_LIST))
-
-push: tag $(patsubst  %,%.push,$(DOCKER_IMAGE_LIST))
-
-pull: $(patsubst  %,%.pull,$(DOCKER_IMAGE_LIST))
-
-%.tag:
-	docker tag ${REGISTRY}${REPOSITORY}voltha-$(subst .tag,,$@):${TAG} ${TARGET_REGISTRY}${TARGET_REPOSITORY}voltha-$(subst .tag,,$@):${TARGET_TAG}
-
-%.push:
-	docker push ${TARGET_REGISTRY}${TARGET_REPOSITORY}voltha-$(subst .push,,$@):${TARGET_TAG}
-
-%.pull:
-	docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG}
+ifdef LOCAL_PROTOS
+	source ./${VENVDIR}/bin/activate ; set -u ;\
+	pip install local_imports/voltha-protos/dist/*.tar.gz
+endif
 
 clean:
-	find . -name '*.pyc' | xargs rm -f
 	rm -rf local_imports
+	find . -name '*.pyc' | xargs rm -f
 
 distclean: clean
 	rm -rf ${VENVDIR}
 
-fetch:
-	@bash -c ' \
-		for i in $(FETCH_IMAGE_LIST); do \
-			docker pull $$i; \
-		done'
-
-purge-venv:
-	rm -fr ${VENVDIR}
-
-rebuild-venv: purge-venv venv
-
-ifneq ($(VOLTHA_BUILD),docker)
-venv: ${VENVDIR}/.built
-else
-venv:
-endif
-
-${VENVDIR}/.built:
-	@ virtualenv ${VENVDIR}
-	@ . ${VENVDIR}/bin/activate && \
-	    pip install --upgrade pip; \
-	    if ! pip install -r requirements.txt; \
-	    then \
-	        echo "On MAC OS X, if the installation failed with an error \n'<openssl/opensslv.h>': file not found,"; \
-	        echo "see the BUILD.md file for a workaround"; \
-	    else \
-	        uname -s > ${VENVDIR}/.built; \
-	    fi
-
-ifdef LOCAL_PYVOLTHA
-	mkdir -p local_imports/pyvoltha/dist
-	cp ../../pyvoltha/dist/*.tar.gz local_imports/pyvoltha/dist/
-	. ${VENVDIR}/bin/activate && \
-	    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
-
-flake8: $(DIRS_FLAKE8)
-
 # end file
diff --git a/python/docker/Dockerfile.adapter_ponsim_olt b/python/docker/Dockerfile.adapter_ponsim_olt
index 2d6c033..d5d1bf0 100644
--- a/python/docker/Dockerfile.adapter_ponsim_olt
+++ b/python/docker/Dockerfile.adapter_ponsim_olt
@@ -11,13 +11,30 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-ARG TAG=latest
-ARG REGISTRY=
-ARG REPOSITORY=
+FROM ubuntu:16.04
 
-FROM ${REGISTRY}${REPOSITORY}voltha-base:${TAG}
+# Update to have latest images
+RUN apt-get update && \
+    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
 
-MAINTAINER Voltha Community <info@opennetworking.org>
+# Install current version of pip rather than outdated pip from apt
+RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
+RUN python /tmp/get-pip.py
+
+# Install adapter requirements.
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install -r /tmp/requirements.txt
+
+ARG LOCAL_PYVOLTHA
+ARG LOCAL_PROTOS
+COPY local_imports/ /local_imports/
+RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+fi
+
+RUN if [ -n "$LOCAL_PROTOS" ] ; then \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+fi
 
 # Bundle app source
 RUN mkdir /voltha && touch /voltha/__init__.py
@@ -28,3 +45,18 @@
 
 # Exposing process and default entry point
 CMD ["python", "/voltha/python/adapters/ponsim_olt/main.py"]
+
+# Label image
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+
+LABEL org.label-schema.schema-version=1.0 \
+      org.label-schema.name=voltha-adapter-ponsim-olt \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
diff --git a/python/docker/Dockerfile.adapter_ponsim_onu b/python/docker/Dockerfile.adapter_ponsim_onu
index e34483e..10c8ef2 100644
--- a/python/docker/Dockerfile.adapter_ponsim_onu
+++ b/python/docker/Dockerfile.adapter_ponsim_onu
@@ -11,13 +11,30 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-ARG TAG=latest
-ARG REGISTRY=
-ARG REPOSITORY=
+FROM ubuntu:16.04
 
-FROM ${REGISTRY}${REPOSITORY}voltha-base:${TAG}
+# Update to have latest images
+RUN apt-get update && \
+    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
 
-MAINTAINER Voltha Community <info@opennetworking.org>
+# Install current version of pip rather than outdated pip from apt
+RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
+RUN python /tmp/get-pip.py
+
+# Install adapter requirements.
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install -r /tmp/requirements.txt
+
+ARG LOCAL_PYVOLTHA
+ARG LOCAL_PROTOS
+COPY local_imports/ /local_imports/
+RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+fi
+
+RUN if [ -n "$LOCAL_PROTOS" ] ; then \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+fi
 
 # Bundle app source
 RUN mkdir /voltha && touch /voltha/__init__.py
@@ -28,3 +45,18 @@
 
 # Exposing process and default entry point
 CMD ["python", "/voltha/python/adapters/ponsim_onu/main.py"]
+
+# Label image
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+
+LABEL org.label-schema.schema-version=1.0 \
+      org.label-schema.name=voltha-adapter-ponsim-onu \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
diff --git a/python/docker/Dockerfile.base b/python/docker/Dockerfile.base
deleted file mode 100644
index 70f4c3f..0000000
--- a/python/docker/Dockerfile.base
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2016 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM ubuntu:xenial
-
-MAINTAINER Voltha Community <info@opennetworking.org>
-
-ARG LOCAL_PYVOLTHA
-ARG LOCAL_PROTOS
-
-# Update to have latest images
-RUN apt-get update && \
-    apt-get install -y python python-pip openssl iproute2 libpcap-dev wget
-
-COPY requirements.txt /tmp/requirements.txt
-
-# pip install cython enum34 six && \
-# Install app dependencies
-RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
-    dpkg -i *.deb && \
-    rm -f *.deb && \
-    apt-get update && \
-    apt-get install -y wget build-essential make gcc binutils python-dev libffi-dev libssl-dev git && \
-    pip install -r /tmp/requirements.txt
-
-#COPY POTENTIAL LOCAL IMPORTS
-COPY local_imports/ /local_imports/
-
-RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \ 
-        pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
-fi 
-
-RUN if [ -n "$LOCAL_PROTOS" ] ; then \
-        pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
-fi
-
-RUN     apt-get purge -y wget build-essential make gcc binutils python-dev libffi-dev libssl-dev git && \
-    apt-get autoremove -y
-
-
diff --git a/python/docker/Dockerfile.cli b/python/docker/Dockerfile.cli
index 42a3c65..9f340de 100644
--- a/python/docker/Dockerfile.cli
+++ b/python/docker/Dockerfile.cli
@@ -11,13 +11,30 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-ARG TAG=latest
-ARG REGISTRY=
-ARG REPOSITORY=
+FROM ubuntu:16.04
 
-FROM ${REGISTRY}${REPOSITORY}voltha-base:${TAG}
+# Update to have latest images
+RUN apt-get update && \
+    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
 
-MAINTAINER Voltha Community <info@opennetworking.org>
+# Install current version of pip rather than outdated pip from apt
+RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
+RUN python /tmp/get-pip.py
+
+# Install adapter requirements.
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install -r /tmp/requirements.txt
+
+ARG LOCAL_PYVOLTHA
+ARG LOCAL_PROTOS
+COPY local_imports/ /local_imports/
+RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+fi
+
+RUN if [ -n "$LOCAL_PROTOS" ] ; then \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+fi
 
 # Bundle app source
 RUN mkdir /voltha && touch /voltha/__init__.py
@@ -26,7 +43,6 @@
 RUN touch /voltha/python/__init__.py
 RUN touch /voltha/python/cli/__init__.py
 
-
 # Setup the voltha user
 RUN useradd -b /home -d /home/voltha voltha -s /bin/bash
 RUN mkdir /home/voltha
@@ -50,3 +66,18 @@
 ENTRYPOINT ["/usr/bin/dumb-init", "--"]
 
 CMD ["/voltha/python/cli/setup.sh"]
+
+# Label image
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+
+LABEL org.label-schema.schema-version=1.0 \
+      org.label-schema.name=voltha-cli \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
diff --git a/python/docker/Dockerfile.ofagent b/python/docker/Dockerfile.ofagent
index 564da05..2037fa0 100644
--- a/python/docker/Dockerfile.ofagent
+++ b/python/docker/Dockerfile.ofagent
@@ -11,13 +11,30 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-ARG TAG=latest
-ARG REGISTRY=
-ARG REPOSITORY=
+FROM ubuntu:16.04
 
-FROM ${REGISTRY}${REPOSITORY}voltha-base:${TAG}
+# Update to have latest images
+RUN apt-get update && \
+    apt-get install -y python openssl iproute2 libpcap-dev wget build-essential git binutils python-dev libffi-dev libssl-dev
 
-MAINTAINER Voltha Community <info@opennetworking.org>
+# Install current version of pip rather than outdated pip from apt
+RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
+RUN python /tmp/get-pip.py
+
+# Install adapter requirements.
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install -r /tmp/requirements.txt
+
+ARG LOCAL_PYVOLTHA
+ARG LOCAL_PROTOS
+COPY local_imports/ /local_imports/
+RUN if [ -n "$LOCAL_PYVOLTHA" ] ; then \
+    pip install /local_imports/pyvoltha/dist/*.tar.gz ; \
+fi
+
+RUN if [ -n "$LOCAL_PROTOS" ] ; then \
+    pip install /local_imports/voltha-protos/dist/*.tar.gz ; \
+fi
 
 # Bundle app source
 RUN mkdir /ofagent  && \
@@ -27,7 +44,17 @@
 COPY ofagent /ofagent/ofagent
 COPY pki /ofagent/pki
 
-ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+# Label image
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
 
-# Exposing process and default entry point
-CMD ["dumb-init", "python", "ofagent/ofagent/main.py"]
+LABEL org.label-schema.schema-version=1.0 \
+      org.label-schema.name=voltha-ofagent \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date
diff --git a/python/env.sh b/python/env.sh
index ec3b52f..c9a6245 100644
--- a/python/env.sh
+++ b/python/env.sh
@@ -12,18 +12,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # sourcing this file is needed to make local development and integration testing work
-export VOLTHA_BASE=$PWD
 
-# load local python virtualenv if exists, otherwise create it
-VENVDIR="venv-$(uname -s | tr '[:upper:]' '[:lower:]')"
-if [ ! -e "$VENVDIR/.built" ]; then
-    echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-    echo "Initializing OS-appropriate virtual env."
-    echo "This will take a few minutes."
-    echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-    make venv
+# load local python virtualenv if exists
+VENVDIR="venv-volthago"
+if [ -e "$VENVDIR/bin/activate" ]; then
+    . $VENVDIR/bin/activate
+else
+   echo "Run 'make venv' to setup python development environment"
 fi
-. $VENVDIR/bin/activate
-
-# add top-level voltha dir to pythonpath
-export PYTHONPATH=$VOLTHA_BASE/$VENVDIR/lib/python2.7/site-packages:$PYTHONPATH:$VOLTHA_BASE:$VOLTHA_BASE/cli:$VOLTHA_BASE/protos/third_party