blob: 8081beb105f5ca99399e957f0a82397c20482115 [file] [log] [blame]
khenaidoocfee5f42018-07-19 22:47:38 -04001# -------------
2# Build stage
3
khenaidooffe076b2019-01-15 16:08:08 -05004FROM golang:1.10.7-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
khenaidooffe076b2019-01-15 16:08:08 -05009# Install protobuf requirements
10RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
khenaidooffe076b2019-01-15 16:08:08 -050011RUN go get google.golang.org/genproto/googleapis/api/annotations
12
khenaidoocfee5f42018-07-19 22:47:38 -040013# Prepare directory structure
William Kurkiandaa6bb22019-03-07 12:26:28 -050014RUN ["mkdir", "-p", "/src"]
khenaidoocfee5f42018-07-19 22:47:38 -040015RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
William Kurkiandaa6bb22019-03-07 12:26:28 -050016RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-go"]
khenaidoocfee5f42018-07-19 22:47:38 -040017
khenaidooffe076b2019-01-15 16:08:08 -050018WORKDIR $GOPATH/src/github.com/opencord/voltha-go
19
khenaidoocfee5f42018-07-19 22:47:38 -040020# Copy files
khenaidooffe076b2019-01-15 16:08:08 -050021ADD rw_core ./rw_core
22ADD common ./common
23ADD db ./db
24ADD kafka ./kafka
25ADD vendor ./vendor
26
khenaidoocfee5f42018-07-19 22:47:38 -040027# Build rw_core
khenaidooac637102019-01-14 15:44:34 -050028RUN cd rw_core && go build -o /src/rw_core
khenaidoocfee5f42018-07-19 22:47:38 -040029
30# -------------
31# Image creation stage
32
khenaidooffe076b2019-01-15 16:08:08 -050033FROM alpine:3.8
khenaidoocfee5f42018-07-19 22:47:38 -040034
35# Set the working directory
36WORKDIR /app
37
38# Copy required files
39COPY --from=build-env /src/rw_core /app/
40