Updated protoc container to include protoc-gen-grpc-gateway and protoc-gen-swagger.
Motivated by VOL-2629
Change-Id: I249a7b075d9c46e75e0d7ab773c6cab79b2fc7bc
diff --git a/Makefile b/Makefile
index d9ae15d..e639bf9 100644
--- a/Makefile
+++ b/Makefile
@@ -16,15 +16,16 @@
SHELL = bash -e -o pipefail
## Variables
-VERSION ?= $(shell cat ./VERSION)
-GO_JUNIT_REPORT_VERSION ?= "0.9.1"
-GOCOVER_COBERTURA_VERSION ?= "v0.0.0-20180217150009-aaee18c8195c"
-GOLANG_VERSION ?= "1.13.8"
-GOLANGCI_LINT_VERSION ?= "1.23.6"
-HADOLINT_VERSION ?= "1.17.5"
-PROTOC_VERSION ?= "3.7.0"
-PROTOC_SHA256SUM ?= "a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969"
-PROTOC_GEN_GO_VERSION ?= "1.3.1"
+VERSION ?= $(shell cat ./VERSION)
+GO_JUNIT_REPORT_VERSION ?= "0.9.1"
+GOCOVER_COBERTURA_VERSION ?= "v0.0.0-20180217150009-aaee18c8195c"
+GOLANG_VERSION ?= "1.13.8"
+GOLANGCI_LINT_VERSION ?= "1.23.6"
+HADOLINT_VERSION ?= "1.17.5"
+PROTOC_VERSION ?= "3.7.0"
+PROTOC_SHA256SUM ?= "a1b8ed22d6dc53c5b8680a6f1760a305b33ef471bece482e92728f00ba2a2969"
+PROTOC_GEN_GO_VERSION ?= "1.3.2"
+PROTOC_GEN_GRPC_GATEWAY_VERSION ?= "1.12.2"
# Docker related
DOCKER_LABEL_VCS_DIRTY = false
@@ -109,6 +110,7 @@
--build-arg PROTOC_VERSION=${PROTOC_VERSION} \
--build-arg PROTOC_SHA256SUM=${PROTOC_SHA256SUM} \
--build-arg PROTOC_GEN_GO_VERSION=${PROTOC_GEN_GO_VERSION} \
+ --build-arg PROTOC_GEN_GRPC_GATEWAY_VERSION=${PROTOC_GEN_GRPC_GATEWAY_VERSION} \
-t ${IMAGENAME}:${VERSION}-protoc \
-t ${IMAGENAME}:latest-protoc \
-f docker/protoc.Dockerfile .
diff --git a/VERSION b/VERSION
index 227cea2..7ec1d6d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.0
+2.1.0
diff --git a/docker/protoc.Dockerfile b/docker/protoc.Dockerfile
index bce36c1..4edf72c 100644
--- a/docker/protoc.Dockerfile
+++ b/docker/protoc.Dockerfile
@@ -15,13 +15,17 @@
FROM golang:1.13.8-alpine as build
ARG PROTOC_VERSION
-ARG PROTOC_GEN_GO_VERSION
ARG PROTOC_SHA256SUM
+ARG PROTOC_GEN_GO_VERSION
+ARG PROTOC_GEN_GRPC_GATEWAY_VERSION
RUN apk add --no-cache libatomic=9.2.0-r3 musl=1.1.24-r0
# download & compile this specific version of protoc-gen-go
-RUN GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v$PROTOC_GEN_GO_VERSION
+RUN GO111MODULE=on CGO_ENABLED=0 go get -u \
+ github.com/golang/protobuf/protoc-gen-go@v$PROTOC_GEN_GO_VERSION \
+ github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v$PROTOC_GEN_GRPC_GATEWAY_VERSION \
+ github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v$PROTOC_GEN_GRPC_GATEWAY_VERSION
RUN mkdir -p /tmp/protoc3 && \
wget -O /tmp/protoc-${PROTOC_VERSION}-linux-x86_64.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
@@ -41,7 +45,7 @@
COPY --from=build /tmp/protoc3/bin/* /usr/local/bin/
COPY --from=build /tmp/protoc3/include/ /usr/local/include/
-# copy protoc-gen-go
+# copy protoc-gen-go, protoc-gen-grpc-gateway, and protoc-gen-swagger
COPY --from=build /go/bin/* /usr/local/bin/
WORKDIR /app
@@ -55,6 +59,7 @@
ARG org_opencord_vcs_dirty=unknown
ARG PROTOC_VERSION=unknown
ARG PROTOC_GEN_GO_VERSION=unknown
+ARG PROTOC_GEN_GRPC_GATEWAY_VERSION=unknown
LABEL org.label-schema.schema-version=1.0 \
org.label-schema.name=voltha-protoc \
@@ -65,4 +70,5 @@
org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
org.opencord.vcs-dirty=$org_opencord_vcs_dirty \
org.opencord.protoc-version=$PROTOC_VERSION \
- org.opencord.protoc-gen-go-version=$PROTOC_GEN_GO_VERSION
+ org.opencord.protoc-gen-go-version=$PROTOC_GEN_GO_VERSION \
+ org.opencord.protoc-gen-grpc-gateway-version=$PROTOC_GEN_GRPC_GATEWAY_VERSION