blob: 0e20b444659ff29adb58cb1ded17d1640f508d78 [file] [log] [blame]
Phaneendra Manda4c62c802019-03-06 21:37:49 +05301# -------------
2# Build stage
3
Matt Jeanneretcab955f2019-04-10 15:45:57 -04004FROM golang:1.10-alpine3.9 AS build-env
Phaneendra Manda4c62c802019-03-06 21:37:49 +05305
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
Matt Jeanneretcab955f2019-04-10 15:45:57 -040029FROM alpine:3.9
Phaneendra Manda4c62c802019-03-06 21:37:49 +053030
31# Set the working directory
32WORKDIR /app
33
34# Copy required files
35COPY --from=build-env /src/openolt /app/
36