Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 4 | FROM golang:1.10-alpine3.9 AS build-env |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 5 | |
| 6 | # Install required packages |
| 7 | RUN apk add --no-cache wget git make build-base protobuf protobuf-dev |
| 8 | |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 9 | # Prepare directory structure |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 10 | RUN ["mkdir", "-p", "/src"] |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 11 | RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"] |
| 12 | RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord"] |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 13 | RUN ["mkdir", "-p", "$GOPATH/src/github.com/opencord/voltha-openolt-adapter"] |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 14 | |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 15 | WORKDIR $GOPATH/src/github.com/opencord/voltha-openolt-adapter |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 16 | |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 17 | COPY adaptercore ./adaptercore |
| 18 | COPY config ./config |
| 19 | COPY vendor ./vendor |
| 20 | COPY *.go ./ |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 21 | |
| 22 | # Build openolt |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 23 | RUN go build -o /src/openolt |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 24 | |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 25 | |
| 26 | # ------------- |
| 27 | # Image creation stage |
| 28 | |
Matt Jeanneret | cab955f | 2019-04-10 15:45:57 -0400 | [diff] [blame] | 29 | FROM alpine:3.9 |
Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 30 | |
| 31 | # Set the working directory |
| 32 | WORKDIR /app |
| 33 | |
| 34 | # Copy required files |
| 35 | COPY --from=build-env /src/openolt /app/ |
| 36 | |