sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
sslobodr | 2fb98b8 | 2019-01-21 09:29:51 -0500 | [diff] [blame] | 4 | FROM base AS build-env |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 5 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 6 | WORKDIR $GOPATH/src/github.com/opencord/voltha-go |
| 7 | |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 8 | # Copy files |
| 9 | COPY rw_core ./rw_core |
| 10 | COPY afrouter ./afrouter |
| 11 | |
| 12 | # Copy config and runtime protobuf needed for routing |
| 13 | RUN cp afrouter/arouter.json /build |
| 14 | RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build |
| 15 | |
| 16 | # Build |
| 17 | RUN cd afrouter && go build -o /build/afrouter |
| 18 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 19 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 20 | # ------------- |
| 21 | # Image creation stage |
| 22 | |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 23 | FROM alpine:3.9 |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 24 | |
| 25 | # Set the working directory |
| 26 | WORKDIR /app |
| 27 | |
| 28 | # Copy required files |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 29 | COPY --from=build-env /build/afrouter /app/ |
| 30 | COPY --from=build-env /build/arouter.json /app/ |
| 31 | COPY --from=build-env /build/voltha.pb /app |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 32 | |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 33 | ENTRYPOINT ["/app/afrouter"] |