blob: d9251b03f1765e256c88c6e3e59f4fbba3cf6c75 [file] [log] [blame]
khenaidood2b6df92018-12-13 16:37:20 -05001# -------------
2# Build stage
3
khenaidooffe076b2019-01-15 16:08:08 -05004FROM golang:1.10.7-alpine AS build-env
khenaidood2b6df92018-12-13 16:37:20 -05005
6# Install required packages
7RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
8
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
khenaidood2b6df92018-12-13 16:37:20 -050013# Prepare directory structure
William Kurkiandaa6bb22019-03-07 12:26:28 -050014RUN ["mkdir", "-p", "/src"]
khenaidood2b6df92018-12-13 16:37:20 -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"]
khenaidood2b6df92018-12-13 16:37:20 -050017
khenaidooffe076b2019-01-15 16:08:08 -050018WORKDIR $GOPATH/src/github.com/opencord/voltha-go
19
khenaidood2b6df92018-12-13 16:37:20 -050020# Copy files
khenaidooffe076b2019-01-15 16:08:08 -050021ADD adapters/simulated_olt ./adapters/simulated_olt
22ADD adapters/common ./adapters/common
23ADD adapters/*.go ./adapters/
24ADD common ./common
25ADD db ./db
26ADD kafka ./kafka
27ADD vendor ./vendor
28
khenaidood2b6df92018-12-13 16:37:20 -050029# Build simulated_olt
khenaidooffe076b2019-01-15 16:08:08 -050030RUN cd adapters/simulated_olt && go build -o /src/simulated_olt
khenaidood2b6df92018-12-13 16:37:20 -050031
32# -------------
33# Image creation stage
34
khenaidooffe076b2019-01-15 16:08:08 -050035FROM alpine:3.8
khenaidood2b6df92018-12-13 16:37:20 -050036
37# Set the working directory
38WORKDIR /app
39
40# Copy required files
41COPY --from=build-env /src/simulated_olt /app/
42