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