blob: be87905e689165cab831d8286d4fc4fe2b7b7d53 [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
9
10RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
11
12# Prepare directory structure
13RUN ["mkdir", "-p", "/src", "src/protos"]
14RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
15RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
16
17# Install golang protobuf
18RUN go get github.com/golang/protobuf/protoc-gen-go
19RUN go get google.golang.org/genproto/googleapis/rpc/status
20RUN go get google.golang.org/grpc/binarylog/grpc_binarylog_v1
21
22# Copy files
23ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
24ADD common $GOPATH/src/github.com/opencord/voltha-go/common
25ADD db $GOPATH/src/github.com/opencord/voltha-go/db
26ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
27ADD vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
28ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
29
30
31# Copy required proto files
32# ... VOLTHA proos
33ADD protos/*.proto /src/protos/
34ADD protos/scripts/* /src/protos/
35ADD afrouter/arouter.json /src
36
37#
38# Copy generated executables here
39WORKDIR $GOPATH/src/github.com/opencord/voltha-go
40
41#RUN ls -ltrR /go/src/github.com/opencord/voltha-go
42
43# Install golang protobuf
44#RUN go get github.com/golang/protobuf/protoc-gen-go
45#RUN go get google.golang.org/genproto/googleapis/rpc/status
46#RUN go get google.golang.org/grpc/binarylog/grpc_binarylog_v1
47RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go
48
49# Compile protobuf files
50RUN sh /src/protos/build_protos.sh /src/protos
51
52# Build rw_core
53RUN cd afrouter && go build -o /src/afrouter
54
55
56# -------------
57# Image creation stage
58
59FROM alpine:3.6
60
61# Set the working directory
62WORKDIR /app
63
64# Copy required files
65COPY --from=build-env /src/afrouter /app/
66COPY --from=build-env /src/arouter.json /app/
67COPY --from=build-env /src/protos/voltha.pb /app/
68WORKDIR config
69WORKDIR /app
70
71#CMD cd /app && ./arouter -config config/arouter.voltha2.json
72
73# Set the config volume
74