blob: a909ee02d4abdae60251070e96c275d9eabcf157 [file] [log] [blame]
# -------------
# Build stage
FROM golang:1.9.2-alpine AS build-env
# Install required packages
RUN apk add --no-cache wget git make build-base protobuf protobuf-dev
# Prepare directory structure
RUN ["mkdir", "-p", "/src", "src/protos"]
RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha/protos/go"]
# Copy files
ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
ADD common $GOPATH/src/github.com/opencord/voltha-go/common
ADD db $GOPATH/src/github.com/opencord/voltha-go/db
ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
ADD vendor $GOPATH/src/github.com/opencord/voltha-go/vendor
# Copy required proto files
# ... VOLTHA proos
ADD protos/*.proto /src/protos/
ADD protos/scripts/* /src/protos/
WORKDIR $GOPATH/src/github.com/opencord/voltha-go
# Install golang protobuf
RUN git clone https://github.com/googleapis/googleapis.git /usr/local/include/googleapis
RUN go install ./vendor/github.com/golang/protobuf/protoc-gen-go
# Compile protobuf files
RUN sh /src/protos/build_protos.sh /src/protos
# Build rw_core
RUN cd rw_core && go build -o /src/rw_core
# -------------
# Image creation stage
FROM alpine:3.6
# Set the working directory
WORKDIR /app
# Copy required files
COPY --from=build-env /src/rw_core /app/