khenaidoo | cfee5f4 | 2018-07-19 22:47:38 -0400 | [diff] [blame^] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
| 4 | FROM golang:alpine AS build-env |
| 5 | |
| 6 | # Install required packages |
| 7 | RUN apk add --no-cache wget git make build-base |
| 8 | |
| 9 | # Prepare directory structure |
| 10 | RUN ["mkdir", "-p", "/src"] |
| 11 | RUN ["mkdir", "-p", "$GOPATH/src", "$GOPATH/pkg", "$GOPATH/bin"] |
| 12 | |
| 13 | # Copy files |
| 14 | ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core |
| 15 | ADD common $GOPATH/src/github.com/opencord/voltha-go/common |
| 16 | ADD db $GOPATH/src/github.com/opencord/voltha-go/db |
| 17 | |
| 18 | # Build rw_core |
| 19 | RUN cd $GOPATH/src/github.com/opencord/voltha-go/rw_core && go get -d ./... && go build -o /src/rw_core |
| 20 | |
| 21 | # ------------- |
| 22 | # Image creation stage |
| 23 | |
| 24 | FROM alpine:3.6 |
| 25 | |
| 26 | # Set the working directory |
| 27 | WORKDIR /app |
| 28 | |
| 29 | # Copy required files |
| 30 | COPY --from=build-env /src/rw_core /app/ |
| 31 | |