VOL-2131 Create voltha python base docker image

Change-Id: I2c996b72903f0445674041ba6ec597ce3981ba2f
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..c6e11db
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,54 @@
+# 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:16.04
+
+# Update to have latest images
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends \
+        ca-certificates=20170717~16.04.2 \
+	python=2.7.12-1~16.04 \
+	openssl=1.0.2g-1ubuntu4.15 \
+	iproute2=4.3.0-1ubuntu3.16.04.5 \
+	libpcap-dev=1.7.4-2 \
+	wget=1.17.1-1ubuntu1.5 \
+	build-essential=12.1ubuntu2 \
+	git=1:2.7.4-0ubuntu1.6 \
+	binutils=2.26.1-1ubuntu1~16.04.8 \
+	python-dev=2.7.12-1~16.04 \
+	libffi-dev=3.2.1-4 \
+	libssl-dev=1.0.2g-1ubuntu4.15 \
+	&& apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# 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
+
+# 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-python-base \
+      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/Makefile b/Makefile
new file mode 100644
index 0000000..31d9137
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,74 @@
+#
+# Copyright 2018 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.
+#
+
+# 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}
+IMAGENAME                := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}voltha-python-base:${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
+
+.PHONY: docker-build
+
+# This should to be the first and default target in this Makefile
+help:
+	@echo "Usage: make [<target>]"
+	@echo "where available targets are:"
+	@echo
+	@echo "docker-build      : Build the ubuntu python base docker image"
+	@echo "help              : Print this help"
+	@echo "docker-push       : Push the docker images to an external repository"
+	@echo
+
+
+## Docker targets
+
+build: docker-build
+
+# only test is that the docker container builds
+test: docker-build
+
+docker-build:
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${IMAGENAME} \
+    --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 Dockerfile .
+
+docker-push:
+	docker push ${IMAGENAME}
+
+# end file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..855d5db
--- /dev/null
+++ b/README.md
@@ -0,0 +1,37 @@
+# voltha-python-base
+
+Ubuntu image with Python and pip packages as a generic base for VOLTHA 2.x
+containers.  This exists because build duplication of the same apt
+and pip install dependencies cause needless build delay times.  Also this
+guarantees a consistent set of dependencies needed for stability.
+
+By making a base image the compilation time is avoided and having a shared base
+image can speed image downloads.
+
+## Characteristics
+
+- Has *no VOLTHA-specific code* and it's own `VERSION` independent of VOLTHA
+  development, so changes will happen more slowly, only when Ubuntu, Python or included
+  packages have new releases.
+
+- Installed via `apt`:
+  - Standard toolchain (gcc, make, etc.) for building native extensions in Python
+  - Libraries to build dependencies - libpcap-dev, python-dev, libressl, libffi
+  - python2, pip, setuptools
+
+- Installed via `pip`:
+  - gRPC python libraries, and googleapi common protobuf definitions
+  - kafkaloghandler
+  - PyYAML
+  - etcd
+  - Twisted
+  - among others...
+
+## Building
+
+Run `make build` to build the container image, `make push` to send to a
+registry.
+
+## Testing
+
+Currently the only test is to perform a container image build.
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+1.0.0
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..02bb3d7
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,61 @@
+argparse==1.2.1
+arrow==0.10.0
+bitstring==3.1.5
+cmd2==0.7.0
+colorama==0.3.9
+confluent-kafka==0.11.5
+cython==0.24.1
+decorator==4.1.2
+docker-py==1.10.6
+fluent-logger==0.6.0
+grpc==0.3.post19
+grpcio==1.16.0
+grpcio-tools==1.16.0
+hash_ring==1.3.1
+hexdump==3.3
+jinja2==2.8
+jsonpatch==1.16
+kafka_python==1.3.5
+kafkaloghandler==0.9.0
+klein==17.10.0
+kubernetes==5.0.0
+netaddr==0.7.19
+networkx==2.0
+netifaces==0.10.6
+pcapy==0.11.1
+pep8==1.7.1
+pep8-naming>=0.3.3
+protobuf==3.6.1
+protobuf-to-dict==0.1.0
+pyflakes==2.1.0
+pylint==1.9.4
+pyOpenSSL==17.3.0
+PyYAML==3.12
+requests==2.18.4
+scapy==2.3.3
+service-identity==17.0.0
+simplejson==3.12.0
+jsonschema==2.6.0
+six==1.12.0
+structlog==17.2.0
+termcolor==1.1.0
+transitions==0.6.4
+treq==17.8.0
+Twisted==18.7.0
+txaioetcd==0.3.0
+urllib3==1.22
+pyang==1.7.3
+lxml==3.6.4
+nosexcover==1.0.11
+zmq==0.0.0
+pyzmq==16.0.3
+txZMQ==0.8.0
+ncclient==0.5.3
+xmltodict==0.11.0
+dicttoxml==1.7.4
+etcd3==0.7.0
+pyparsing==2.2.0
+packaging==17.1
+pexpect==4.6.0
+python-consul==0.6.2
+afkak==3.0.0.dev20181106