[SEBA-497]

Initial commit to alpine-grpc-base

Change-Id: I9ce594a7b9f08eef7ecc478b8da91d371d8a6414
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..dc160f8
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,6 @@
+[gerrit]
+host=gerrit.opencord.org
+port=29418
+project=alpine-grpc-base.git
+defaultremote=origin
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1a9cff0
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,48 @@
+# 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.
+
+# xosproject/alpine-grpc-base
+FROM alpine:3.9.2
+
+# Install apk packages
+RUN apk add --no-cache \
+    build-base \
+    libffi-dev \
+    librdkafka-dev \
+    libressl-dev \
+    py-setuptools \
+    py2-pip \
+    python2-dev \
+ && mkdir /var/xos \
+ && pip freeze > /var/xos/pip_freeze_apk_`date -u +%Y%m%dT%H%M%S`
+
+# Install pip packages
+COPY requirements.txt /tmp/requirements.txt
+RUN pip install -r /tmp/requirements.txt \
+ && pip freeze > /var/xos/pip_freeze_alpine_grpc_base_`date -u +%Y%m%dT%H%M%S`
+
+# 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=alpine-grpc-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..ea3f593
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,53 @@
+# 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.
+
+# Configure shell
+SHELL = bash -eu -o pipefail
+
+# Variables
+VERSION                  ?= $(shell cat ./VERSION)
+CONTAINER_NAME           ?= $(notdir $(abspath .))
+
+## Docker related
+DOCKER_REGISTRY          ?=
+DOCKER_REPOSITORY        ?=
+DOCKER_BUILD_ARGS        ?=
+DOCKER_TAG               ?= ${VERSION}
+DOCKER_IMAGENAME         := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}${CONTAINER_NAME}:${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")
+
+all: test
+
+docker-build:
+	docker build $(DOCKER_BUILD_ARGS) \
+    -t ${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}" \
+    -f Dockerfile .
+
+docker-push:
+	docker push ${DOCKER_IMAGENAME}
+
+test: docker-build
+
+clean:
+	@echo "No cleanup available"
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5abf8d3
--- /dev/null
+++ b/README.md
@@ -0,0 +1,35 @@
+# alpine-grpc-base
+
+Alpine image with gRPC and protobuf python tools as a generic base for XOS
+containers.  This exists because building prebuilt binary wheels of certain
+python modules, specifically `grpcio` and `grpcio-tools` takes >10 minutes on
+Alpine (because of musl libc?).
+
+By making a base image the compilation time is avoided and having a shared base
+image can speed image downloads.
+
+## Characteristics
+
+- Has *no XOS-specific code* and it's own `VERSION` independent of XOS
+  development, so changes will happen more slowly, only when Alpine or included
+  packages have new releases.
+
+- Installed via `apk`:
+  - Standard toolchain (gcc, make, etc.) for building native extensions in Python
+  - Libraries to build dependencies - librdkafka, libressl, libffi
+  - python2, pip, setuptools
+
+- Installed via `pip`:
+  - gRPC python libraries, and googleapi common protobuf definitions
+  - kafkaloghandler
+  - PyYAML
+  - Twisted
+
+## 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..ac39a10
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.9.0
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..624b97a
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,6 @@
+PyYAML==5.1
+Twisted==18.9.0
+googleapis-common-protos==1.5.8
+grpcio-tools==1.19.0
+grpcio==1.19.0
+kafkaloghandler==0.9.0