blob: a909ee02d4abdae60251070e96c275d9eabcf157 [file] [log] [blame]
khenaidoocfee5f42018-07-19 22:47:38 -04001# -------------
2# Build stage
3
khenaidoob9203542018-09-17 22:56:37 -04004FROM golang:1.9.2-alpine AS build-env
khenaidoocfee5f42018-07-19 22:47:38 -04005
6# Install required packages
khenaidooabad44c2018-08-03 16:58:35 -04007RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
khenaidoocfee5f42018-07-19 22:47:38 -04008
9# Prepare directory structure
khenaidooabad44c2018-08-03 16:58:35 -040010RUN ["mkdir", "-p", "/src", "src/protos"]
khenaidoocfee5f42018-07-19 22:47:38 -040011RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
khenaidooabad44c2018-08-03 16:58:35 -040012RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
khenaidoocfee5f42018-07-19 22:47:38 -040013
14# Copy files
15ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
16ADD common $GOPATH/src/github.com/opencord/voltha-go/common
17ADD db $GOPATH/src/github.com/opencord/voltha-go/db
khenaidooabad44c2018-08-03 16:58:35 -040018ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
khenaidooac637102019-01-14 15:44:34 -050019ADD vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
khenaidooabad44c2018-08-03 16:58:35 -040020
21# Copy required proto files
22# ... VOLTHA proos
23ADD protos/*.proto /src/protos/
24ADD protos/scripts/* /src/protos/
25
khenaidooac637102019-01-14 15:44:34 -050026WORKDIR $GOPATH/src/github.com/opencord/voltha-go
27
khenaidooabad44c2018-08-03 16:58:35 -040028# Install golang protobuf
khenaidooac637102019-01-14 15:44:34 -050029RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
30RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go
khenaidooabad44c2018-08-03 16:58:35 -040031
32# Compile protobuf files
33RUN sh /src/protos/build_protos.sh /src/protos
khenaidoocfee5f42018-07-19 22:47:38 -040034
35# Build rw_core
khenaidooac637102019-01-14 15:44:34 -050036RUN cd rw_core && go build -o /src/rw_core
khenaidoocfee5f42018-07-19 22:47:38 -040037
38# -------------
39# Image creation stage
40
41FROM alpine:3.6
42
43# Set the working directory
44WORKDIR /app
45
46# Copy required files
47COPY --from=build-env /src/rw_core /app/
48