blob: 5cf71c414377f20722022e1216bf669bd618d524 [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_olt $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_olt
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_olt
35RUN cd $GOPATH/src/github.com/opencord/voltha-go/adapters/simulated_olt && go get -d ./... && rm -rf $GOPATH/src/go.etcd.io/etcd/vendor/golang.org/x/net/trace && go build -o /src/simulated_olt
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_olt /app/
47