COMAC-142 Set up standardized docker build method for OMEC CNI image

Change-Id: I875a34e113e09e1d7a8d4205bcfd55eda4937247
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..ac39afc
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.opencord.org
+port=29418
+project=omec-cni.git
+defaultremote=origin
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..0a95502
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,71 @@
+#
+# Copyright 2019-present Open Networking Foundation
+# Copyright (c) 2019 Intel Corporation
+#
+# 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.
+
+# Build multus plugin
+FROM golang:1.10 AS multus
+RUN git clone -q --depth 1 https://github.com/intel/multus-cni.git /go/src/github.com/intel/multus-cni
+WORKDIR /go/src/github.com/intel/multus-cni
+RUN ./build
+
+# Build sriov plugin
+FROM golang:1.10 AS sriov-cni
+RUN git clone -q -b dev/k8s-deviceid-model https://github.com/Intel-Corp/sriov-cni.git /go/src/github.com/intel-corp/sriov-cni
+WORKDIR /go/src/github.com/intel-corp/sriov-cni
+RUN ./build
+
+# Build sriov device plugin
+FROM golang:1.10 AS sriov-dp
+RUN git clone -q https://github.com/intel/sriov-network-device-plugin.git /go/src/github.com/intel/sriov-network-device-plugin
+WORKDIR /go/src/github.com/intel/sriov-network-device-plugin
+RUN make
+
+# Build centralip ipam plugin
+FROM golang:1.10 AS centralip-ipam
+RUN go get -u github.com/kardianos/govendor
+RUN git clone -q https://github.com/John-Lin/ovs-cni.git /go/src/github.com/John-Lin/ovs-cni
+WORKDIR /go/src/github.com/John-Lin/ovs-cni
+RUN govendor sync && ./build.sh
+
+# Build vfioveth plugin
+FROM busybox as vfioveth
+RUN wget -O /bin/vfioveth https://raw.githubusercontent.com/clearlinux/cloud-native-setup/master/clr-k8s-examples/9-multi-network/cni/vfioveth
+RUN wget -O /bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
+RUN chmod +x /bin/vfioveth /bin/jq
+
+# Final image
+FROM centos/systemd as omec-cni
+WORKDIR /tmp/cni/bin
+COPY --from=multus /go/src/github.com/intel/multus-cni/bin/multus .
+COPY --from=sriov-cni /go/src/github.com/intel-corp/sriov-cni/bin/sriov .
+COPY --from=centralip-ipam /go/src/github.com/John-Lin/ovs-cni/bin/centralip .
+COPY --from=vfioveth /bin/vfioveth .
+COPY --from=vfioveth /bin/jq .
+WORKDIR /usr/bin
+COPY --from=sriov-dp /go/src/github.com/intel/sriov-network-device-plugin/build/sriovdp .
+
+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=omec-cni \
+      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..586a612
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+#
+# Copyright 2019-present Open Networking Foundation
+#
+# 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.
+#
+
+VERSION                  ?= $(shell cat ./VERSION)
+
+DOCKER_TAG               ?= ${VERSION}
+DOCKER_REGISTRY          ?=
+DOCKER_REPOSITORY        ?=
+DOCKER_BUILD_ARGS        ?=
+DOCKER_BUILD_TARGET      ?= omec-cni
+DOCKER_IMAGENAME         ?= ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${DOCKER_BUILD_TARGET}:${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_VCS_REF     ?= $(shell git diff-index --quiet HEAD -- && git rev-parse HEAD || echo "unknown")
+DOCKER_LABEL_COMMIT_DATE ?= $(shell git diff-index --quiet HEAD -- && git show -s --format=%cd --date=iso-strict HEAD || echo "unknown" )
+DOCKER_LABEL_BUILD_DATE  ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
+
+# https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target
+docker-build:
+	docker build $(DOCKER_BUILD_ARGS) \
+		--target ${DOCKER_BUILD_TARGET} \
+		--tag ${DOCKER_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}" \
+		.
+
+docker-push:
+	docker push ${DOCKER_IMAGENAME}
+
+test: docker-build
+
+.PHONY: docker-build docker-push test
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..bbde226
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# omec-cni
+
+Dockerfile in this reposity incorporates and packages CNI plugins used in OMEC project.
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..8acdd82
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1