Phaneendra Manda | 4c62c80 | 2019-03-06 21:37:49 +0530 | [diff] [blame] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
| 4 | FROM golang:1.10.7-alpine AS build-env |
| 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 | |
| 29 | FROM alpine:3.8 |
| 30 | |
| 31 | # Set the working directory |
| 32 | WORKDIR /app |
| 33 | |
| 34 | # Copy required files |
| 35 | COPY --from=build-env /src/openolt /app/ |
| 36 | |