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.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"]