This update provides:
1) workaround around the build failures. In
summary, it forces the download of some packages during the build
process.
2) update the set of packages that should go inside the vendor
directory
3) Update the dockerfile to use go 1.10
Change-Id: I2bfd090ce0f25b0c10aa214755ae2da7e5384d60
diff --git a/docker/Dockerfile.simulated_olt b/docker/Dockerfile.simulated_olt
index 5cf71c4..4db18af 100644
--- a/docker/Dockerfile.simulated_olt
+++ b/docker/Dockerfile.simulated_olt
@@ -1,43 +1,50 @@
# -------------
# Build stage
-FROM golang:1.9.2-alpine AS build-env
+FROM golang:1.10.7-alpine AS build-env
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
+# Install protobuf requirements
+RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
+RUN go get github.com/golang/protobuf/protoc-gen-go
+RUN go get google.golang.org/genproto/googleapis/api/annotations
+
# Prepare directory structure
RUN ["mkdir", "-p", "/src", "src/protos"]
RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
+WORKDIR $GOPATH/src/github.com/opencord/voltha-go
+
# Copy files
-ADD adapters/simulated_olt $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_olt
-ADD adapters/common $GOPATH/src/github.com/opencord/voltha-go/adapters/common
-ADD adapters/*.go $GOPATH/src/github.com/opencord/voltha-go/adapters/
-ADD common $GOPATH/src/github.com/opencord/voltha-go/common
-ADD db $GOPATH/src/github.com/opencord/voltha-go/db
-ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
+ADD adapters/simulated_olt ./adapters/simulated_olt
+ADD adapters/common ./adapters/common
+ADD adapters/*.go ./adapters/
+ADD common ./common
+ADD db ./db
+ADD kafka ./kafka
+ADD vendor ./vendor
+
+# Install the protoc-gen-go
+RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go
# Copy required proto files
# ... VOLTHA proos
ADD protos/*.proto /src/protos/
ADD protos/scripts/* /src/protos/
-# Install golang protobuf
-RUN go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
-RUN go get -u github.com/golang/protobuf/protoc-gen-go
-
# Compile protobuf files
RUN sh /src/protos/build_protos.sh /src/protos
# Build simulated_olt
-RUN cd $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_olt && go get -d ./... && rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace && go build -o /src/simulated_olt
+RUN cd adapters/simulated_olt && go build -o /src/simulated_olt
# -------------
# Image creation stage
-FROM alpine:3.6
+FROM alpine:3.8
# Set the working directory
WORKDIR /app