sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
| 4 | FROM base AS build-env |
| 5 | |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -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 | COPY tests/afrouter ./tests/afrouter |
| 12 | COPY tests/afrouter /build/tests |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 13 | |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 14 | # Copy config and runtime protobuf needed for routing |
| 15 | RUN cp afrouter/arouter.json /build/tests/suites/ |
| 16 | RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/ |
| 17 | |
| 18 | # Build |
| 19 | RUN cd afrouter && go build -o /build/afrouter |
| 20 | RUN cd tests/afrouter && go build -o /build/afrouterTest |
| 21 | |
| 22 | # Run tests |
| 23 | RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1 |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 24 | |
| 25 | # ------------- |
| 26 | # Image creation stage |
| 27 | |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 28 | FROM alpine:3.9 |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 29 | |
| 30 | # Set the working directory |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 31 | WORKDIR /app |
| 32 | |
| 33 | # Copy required files |
Matt Jeanneret | 85ab508 | 2019-04-01 11:29:20 -0400 | [diff] [blame] | 34 | COPY --from=build-env /build/afrouter /app/ |
| 35 | COPY --from=build-env /build/afrouterTest /app/ |
| 36 | COPY --from=build-env /build/arouter.json /app/ |
| 37 | COPY --from=build-env /build/voltha.pb /app |
| 38 | COPY --from=build-env /build/tests /app/tests/ |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 39 | |