blob: 9fb13be547b427bc856febd040c6cb07087c8824 [file] [log] [blame]
khenaidood2b6df92018-12-13 16:37:20 -05001# -------------
2# Build stage
3
4FROM golang:1.9.2-alpine AS build-env
5
6# Install required packages
7RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
8
9# Prepare directory structure
10RUN ["mkdir", "-p", "/src", "src/protos"]
11RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
12RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
13
14# Copy files
15ADD adapters/simulated_onu $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_onu
16ADD adapters/common $GOPATH/src/github.com/opencord/voltha-go/adapters/common
17ADD adapters/*.go $GOPATH/src/github.com/opencord/voltha-go/adapters/
18ADD common $GOPATH/src/github.com/opencord/voltha-go/common
19ADD db $GOPATH/src/github.com/opencord/voltha-go/db
20ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
21
22# Copy required proto files
23# ... VOLTHA proos
24ADD protos/*.proto /src/protos/
25ADD protos/scripts/* /src/protos/
26
27# Install golang protobuf
28RUN go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
29RUN go get -u github.com/golang/protobuf/protoc-gen-go
30
31# Compile protobuf files
32RUN sh /src/protos/build_protos.sh /src/protos
33
34# Build simulated_onu
35RUN cd $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_onu && go get -d ./... && rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace && go build -o /src/simulated_onu
36
37# -------------
38# Image creation stage
39
40FROM alpine:3.6
41
42# Set the working directory
43WORKDIR /app
44
45# Copy required files
46COPY --from=build-env /src/simulated_onu /app/
47