VOL-1460: Docker builds now use common base image.  Also Documentation Update.

Modified all docker files to use a base build that copies in vendor and
other common GOPATH items.  Then each dependant Dockerfile
uses the base and only copies in golang source needed to build.

Also grab updated lock file and vendor items missing (from a dep ensure)
for build to work.

Change-Id: I6047847c2c186a24d1f223b1a4dfab39ab381a92
diff --git a/docker/Dockerfile.arouter b/docker/Dockerfile.arouter
index 329fc68..5401514 100644
--- a/docker/Dockerfile.arouter
+++ b/docker/Dockerfile.arouter
@@ -3,43 +3,31 @@
 
 FROM base AS build-env
 
-# Copy files
-ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
-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 afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
-ADD vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
-
-# Copy required proto files
-# ... VOLTHA proos
-# Repeat here even if it's done in the base
-ADD afrouter/arouter.json /src
-COPY vendor/github.com/opencord/voltha-protos/go/voltha.pb /src
-
-#
-# Copy generated executables here
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
-# Build rw_core
-RUN cd afrouter && go build -o /src/afrouter
+# Copy files
+COPY rw_core ./rw_core
+COPY afrouter ./afrouter
+
+# Copy config and runtime protobuf needed for routing
+RUN cp afrouter/arouter.json /build
+RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build
+
+# Build
+RUN cd afrouter && go build -o /build/afrouter
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.6
+FROM alpine:3.9
 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/afrouter /app/
-COPY --from=build-env /src/arouter.json /app/
-COPY --from=build-env /src/voltha.pb /app/
-WORKDIR config
-WORKDIR /app
+COPY --from=build-env /build/afrouter /app/
+COPY --from=build-env /build/arouter.json /app/
+COPY --from=build-env /build/voltha.pb /app
 
-#CMD cd /app && ./arouter -config config/arouter.voltha2.json
-
-# Set the config volume
-
+ENTRYPOINT ["/app/afrouter"]
diff --git a/docker/Dockerfile.arouterTest b/docker/Dockerfile.arouterTest
index 302c7b6..6917937 100644
--- a/docker/Dockerfile.arouterTest
+++ b/docker/Dockerfile.arouterTest
@@ -3,66 +3,38 @@
 
 FROM base AS build-env
 
-# Copy files
-ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
-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 afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
-ADD tests/afrouter $GOPATH/src/github.com/opencord/voltha-go/tests/afrouter
-
-# Copy required proto files
-# ... VOLTHA proos
-# Repeat here even if it's done in the base
-ADD protos/*.proto /src/protos/
-ADD protos/scripts/* /src/protos/
-ADD afrouter/arouter.json /src/
-ADD tests/afrouter/suites/* /src/suites/
-ADD tests/afrouter/arouter_test.json /src/
-
-#
-# Copy generated executables here
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
-# Compile protobuf files
-# Repeat here even if it's done in the base
-RUN sh /src/protos/build_protos.sh /src/protos
-#RUN find / -name "*.pb.go" -print
+# Copy files
+COPY rw_core ./rw_core
+COPY afrouter ./afrouter
+COPY tests/afrouter ./tests/afrouter
+COPY tests/afrouter /build/tests
 
-#ADD /src/protos/voltha.pb test/afrouter/suites
-# Build rw_core
-RUN cd afrouter && go build -o /src/afrouter
-#RUN ls -l /src/protos
-RUN cp /src/protos/voltha.pb tests/afrouter/suites
-RUN cd tests/afrouter && go build -o /src/afrouterTest
-RUN mkdir /src/tests
-RUN cd tests/afrouter/suites && /src/afrouterTest -config main.json -logLevel 1
-RUN mkdir /src/temp
-RUN cp -r tests/afrouter/tests /src/temp
-#RUN cd tests/afrouter/tester && go build -o /src/tests
+# Copy config and runtime protobuf needed for routing
+RUN cp afrouter/arouter.json /build/tests/suites/
+RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/
+
+# Build
+RUN cd afrouter && go build -o /build/afrouter
+RUN cd tests/afrouter && go build -o /build/afrouterTest
+
+# Run tests
+RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.6
+FROM alpine:3.9
 
 # Set the working directory
-WORKDIR /app/src
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/afrouter /app/
-COPY --from=build-env /src/afrouterTest /app/
-COPY --from=build-env /src/arouter.json /app/
-COPY --from=build-env /src/arouter_test.json /app/
-COPY --from=build-env /src/protos/voltha.pb /app/
-COPY --from=build-env /src/suites/ /app/suites/
-COPY --from=build-env /src/tests /app
-COPY --from=build-env /src/temp/ /app/src/
-COPY --from=build-env /go/src/github.com/opencord/voltha-go/protos/ /app/protos/
-WORKDIR /app
+COPY --from=build-env /build/afrouter /app/
+COPY --from=build-env /build/afrouterTest /app/
+COPY --from=build-env /build/arouter.json /app/
+COPY --from=build-env /build/voltha.pb /app
+COPY --from=build-env /build/tests /app/tests/
 
-#CMD cd /app && ./arouter -config config/arouter.voltha2.json
-
-# Set the config volume
-
+ENTRYPOINT ["/app/afrouterTest"]
diff --git a/docker/Dockerfile.arouterd b/docker/Dockerfile.arouterd
index f3c1dd3..2d5f139 100644
--- a/docker/Dockerfile.arouterd
+++ b/docker/Dockerfile.arouterd
@@ -3,37 +3,30 @@
 
 FROM base AS build-env
 
-
-# Copy files
-ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
-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 afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
-ADD arouterd $GOPATH/src/github.com/opencord/voltha-go/arouterd
-
-
-# Repeate here even if done in base file
-ADD afrouter/arouter.json /src
-
-#
-# Copy generated executables here
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
-# Compile protobuf files
-# Repeate here even if done in base file
-RUN go get google.golang.org/genproto/googleapis/api/annotations
+# Copy files
+COPY rw_core ./rw_core
+COPY afrouter ./afrouter
+COPY arouterd ./arouterd
 
-# Build rw_core
-RUN cd arouterd && go build -o /src/arouterd
+# Copy config
+RUN cp afrouter/arouter.json /build
+
+# Build
+RUN cd arouterd && go build -o /build/arouterd
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.6
+FROM alpine:3.9
 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/arouterd /app/
+COPY --from=build-env /build/arouterd /app/
+COPY --from=build-env /build/arouter.json /app/
+
+ENTRYPOINT ["/app/arouterd"]
diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base
index 1a22cd9..d07aacb 100644
--- a/docker/Dockerfile.base
+++ b/docker/Dockerfile.base
@@ -1,34 +1,20 @@
 # -------------
 # Build stage
 
-FROM golang:1.10-alpine
-
+FROM golang:1.10-alpine3.9
 
 # Install required packages
-RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
-
-RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
+RUN apk add --no-cache wget git make build-base
 
 # Prepare directory structure
-RUN ["mkdir", "-p", "/src"]
+RUN ["mkdir", "-p", "/build"]
 RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
 RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
-RUN ["mkdir", "-p", "/share"]
 
-# Copy files
-#ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
-#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 vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
-#ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
-
-ADD afrouter/arouter.json /src
-
-#
-# Copy generated executables here
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
-#RUN ls -ltrR /go/src/github.com/opencord/voltha-go
-
-VOLUME /share
+# Copy common files.
+COPY common ./common
+COPY db ./db
+COPY kafka ./kafka
+COPY vendor ./vendor
diff --git a/docker/Dockerfile.ro_core b/docker/Dockerfile.ro_core
index 0784f9a..f4bb80c 100644
--- a/docker/Dockerfile.ro_core
+++ b/docker/Dockerfile.ro_core
@@ -1,40 +1,26 @@
 # -------------
 # Build stage
 
-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 google.golang.org/genproto/googleapis/api/annotations
-
-# Prepare directory structure
-RUN ["mkdir", "-p", "/src"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+FROM base AS build-env
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
-# Copy files
-ADD ro_core ./ro_core
-ADD common ./common
-ADD db ./db
-ADD kafka ./kafka
-ADD vendor ./vendor
+# Copy files.
+COPY ro_core ./ro_core
 
-# Build ro_core
-RUN cd ro_core && go build -o /src/ro_core
+# Build
+RUN cd ro_core && go build -o /build/ro_core
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.8
+FROM alpine:3.9
 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/ro_core /app/
+COPY --from=build-env /build/ro_core /app/
 
+ENTRYPOINT ["/app/ro_core"]
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index 8081beb..23c4ccb 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -1,40 +1,26 @@
 # -------------
 # Build stage
 
-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 google.golang.org/genproto/googleapis/api/annotations
-
-# Prepare directory structure
-RUN ["mkdir", "-p", "/src"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+FROM base AS build-env
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
 # Copy files
-ADD rw_core ./rw_core
-ADD common ./common
-ADD db ./db
-ADD kafka ./kafka
-ADD vendor ./vendor
+COPY rw_core ./rw_core
 
-# Build rw_core
-RUN cd rw_core && go build -o /src/rw_core
+# Build
+RUN cd rw_core && go build -o /build/rw_core
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.8
+FROM alpine:3.9
 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/rw_core /app/
+COPY --from=build-env /build/rw_core /app/
 
+ENTRYPOINT ["/app/rw_core"]
diff --git a/docker/Dockerfile.simulated_olt b/docker/Dockerfile.simulated_olt
index d9251b0..974f7d0 100644
--- a/docker/Dockerfile.simulated_olt
+++ b/docker/Dockerfile.simulated_olt
@@ -1,42 +1,27 @@
 # -------------
 # Build stage
 
-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 google.golang.org/genproto/googleapis/api/annotations
-
-# Prepare directory structure
-RUN ["mkdir", "-p", "/src"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+FROM base AS build-env
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
 # Copy files
-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
+COPY adapters/simulated_olt ./adapters/simulated_olt
+COPY adapters/common ./adapters/common
+COPY adapters/*.go ./adapters/
 
-# Build simulated_olt
-RUN cd adapters/simulated_olt && go build -o /src/simulated_olt
+# Build
+RUN cd adapters/simulated_olt && go build -o /build/simulated_olt
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.8
-
+FROM alpine:3.9 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/simulated_olt /app/
+COPY --from=build-env /build/simulated_olt /app/
 
+ENTRYPOINT ["/app/simulated_olt"]
diff --git a/docker/Dockerfile.simulated_onu b/docker/Dockerfile.simulated_onu
index ae1588f..4b96290 100644
--- a/docker/Dockerfile.simulated_onu
+++ b/docker/Dockerfile.simulated_onu
@@ -1,42 +1,28 @@
 # -------------
 # Build stage
 
-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 google.golang.org/genproto/googleapis/api/annotations
-
-# Prepare directory structure
-RUN ["mkdir", "-p", "/src"]
-RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
-RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
+FROM base AS build-env
 
 WORKDIR $GOPATH/src/github.com/opencord/voltha-go
 
 # Copy files
-ADD adapters/simulated_onu ./adapters/simulated_onu
-ADD adapters/common ./adapters/common
-ADD adapters/*.go ./adapters/
-ADD common ./common
-ADD db ./db
-ADD kafka ./kafka
-ADD vendor ./vendor
+COPY adapters/simulated_onu ./adapters/simulated_onu
+COPY adapters/common ./adapters/common
+COPY adapters/*.go ./adapters/
 
-# Build simulated_onu
-RUN cd adapters/simulated_onu && go build -o /src/simulated_onu
+# Build
+RUN cd adapters/simulated_onu && go build -o /build/simulated_onu
+
 
 # -------------
 # Image creation stage
 
-FROM alpine:3.8
+FROM alpine:3.9
 
 # Set the working directory
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /src/simulated_onu /app/
+COPY --from=build-env /build/simulated_onu /app/
 
+ENTRYPOINT ["/app/simulated_onu"]