blob: eba62e1c6f60fbf440ebb818f9eeb55eb8ba69bf [file] [log] [blame]
sslobodra3ea7d42019-01-16 15:03:16 -05001# -------------
2# Build stage
3
4FROM golang:1.10-alpine AS build-env
5
6
7# Install required packages
8RUN apk add --no-cache wget git make build-base protobuf protobuf-dev curl
9
10RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
11
12RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
13
14# Prepare directory structure
15RUN ["mkdir", "-p", "/src", "src/protos"]
16RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
17RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
18
19# Install golang protobuf
20RUN go get github.com/golang/protobuf/protoc-gen-go
21RUN go get google.golang.org/genproto/googleapis/rpc/status
22RUN go get google.golang.org/grpc/binarylog/grpc_binarylog_v1
23
24# Copy files
25ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
26ADD common $GOPATH/src/github.com/opencord/voltha-go/common
27ADD db $GOPATH/src/github.com/opencord/voltha-go/db
28ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
29ADD vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
30ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
31ADD arouterd $GOPATH/src/github.com/opencord/voltha-go/arouterd
32ADD Gopkg.lock $GOPATH/src/github.com/opencord/voltha-go
33ADD Gopkg.toml $GOPATH/src/github.com/opencord/voltha-go
34
35
36# Copy required proto files
37# ... VOLTHA proos
38ADD protos/*.proto /src/protos/
39ADD protos/scripts/* /src/protos/
40ADD afrouter/arouter.json /src
41
42#
43# Copy generated executables here
44WORKDIR $GOPATH/src/github.com/opencord/voltha-go
45#RUN $GOPATH/bin/dep ensure -add github.com/coreos/etcd
46
47#RUN ls -ltrR /go/src/github.com/opencord/voltha-go
48
49# Install golang protobuf
50#RUN go get github.com/golang/protobuf/protoc-gen-go
51#RUN go get google.golang.org/genproto/googleapis/rpc/status
52#RUN go get google.golang.org/grpc/binarylog/grpc_binarylog_v1
53RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go
54
55# Compile protobuf files
56RUN sh /src/protos/build_protos.sh /src/protos
57
58# Build rw_core
59RUN cd arouterd && go build -o /src/arouterd
60
61
62# -------------
63# Image creation stage
64
65FROM alpine:3.6
66
67# Set the working directory
68WORKDIR /app
69
70# Copy required files
71COPY --from=build-env /src/arouterd /app/