| 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", "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 |
| # Install the protoc-gen-go |
| RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go |
| # Copy required proto files |
| ADD protos/*.proto /src/protos/ |
| ADD protos/scripts/* /src/protos/ |
| RUN sh /src/protos/build_protos.sh /src/protos |
| RUN cd ro_core && go build -o /src/ro_core |
| # Set the working directory |
| COPY --from=build-env /src/ro_core /app/ |