| # ------------- |
| # Build stage |
| |
| FROM golang:1.10-alpine3.9 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"] |
| RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"] |
| RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"] |
| RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-openolt-adapter"] |
| |
| WORKDIR $GOPATH/src/github.com/opencord/voltha-openolt-adapter |
| |
| COPY adaptercore ./adaptercore |
| COPY config ./config |
| COPY vendor ./vendor |
| COPY *.go ./ |
| |
| # Build openolt |
| RUN go build -o /src/openolt |
| |
| |
| # ------------- |
| # Image creation stage |
| |
| FROM alpine:3.9 |
| |
| # Set the working directory |
| WORKDIR /app |
| |
| # Copy required files |
| COPY --from=build-env /src/openolt /app/ |
| |