blob: 0784f9a1d44da69a6aaef427f1b124e40882d112 [file] [log] [blame]
Stephane Barbariea75791c2019-01-24 10:58:06 -05001# -------------
2# Build stage
3
4FROM golang:1.10.7-alpine AS build-env
5
6# Install required packages
7RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
8
9# Install protobuf requirements
10RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
11RUN go get google.golang.org/genproto/googleapis/api/annotations
12
13# Prepare directory structure
William Kurkiandaa6bb22019-03-07 12:26:28 -050014RUN ["mkdir", "-p", "/src"]
Stephane Barbariea75791c2019-01-24 10:58:06 -050015RUN ["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"]
Stephane Barbariea75791c2019-01-24 10:58:06 -050017
18WORKDIR $GOPATH/src/github.com/opencord/voltha-go
19
20# Copy files
21ADD ro_core ./ro_core
22ADD common ./common
23ADD db ./db
24ADD kafka ./kafka
25ADD vendor ./vendor
26
Stephane Barbariea75791c2019-01-24 10:58:06 -050027# Build ro_core
28RUN cd ro_core && go build -o /src/ro_core
29
30# -------------
31# Image creation stage
32
33FROM alpine:3.8
34
35# Set the working directory
36WORKDIR /app
37
38# Copy required files
39COPY --from=build-env /src/ro_core /app/
40