blob: ed2090587f19e33b2fde7ff6fde3c95ac0503f0a [file] [log] [blame]
Phaneendra Manda4c62c802019-03-06 21:37:49 +05301# -------------
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
Phaneendra Manda4c62c802019-03-06 21:37:49 +05309# Prepare directory structure
William Kurkianea869482019-04-09 15:16:11 -040010RUN ["mkdir", "-p", "/src"]
Phaneendra Manda4c62c802019-03-06 21:37:49 +053011RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"]
12RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"]
William Kurkianea869482019-04-09 15:16:11 -040013RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-openolt-adapter"]
Phaneendra Manda4c62c802019-03-06 21:37:49 +053014
William Kurkianea869482019-04-09 15:16:11 -040015WORKDIR $GOPATH/src/github.com/opencord/voltha-openolt-adapter
Phaneendra Manda4c62c802019-03-06 21:37:49 +053016
William Kurkianea869482019-04-09 15:16:11 -040017COPY adaptercore ./adaptercore
18COPY config ./config
19COPY vendor ./vendor
20COPY *.go ./
Phaneendra Manda4c62c802019-03-06 21:37:49 +053021
22# Build openolt
William Kurkianea869482019-04-09 15:16:11 -040023RUN go build -o /src/openolt
Phaneendra Manda4c62c802019-03-06 21:37:49 +053024
Phaneendra Manda4c62c802019-03-06 21:37:49 +053025
26# -------------
27# Image creation stage
28
29FROM alpine:3.8
30
31# Set the working directory
32WORKDIR /app
33
34# Copy required files
35COPY --from=build-env /src/openolt /app/
36