sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 1 | # ------------- |
| 2 | # Build stage |
| 3 | |
| 4 | FROM base AS build-env |
| 5 | |
| 6 | # Copy files |
| 7 | ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core |
| 8 | ADD common $GOPATH/src/github.com/opencord/voltha-go/common |
| 9 | ADD db $GOPATH/src/github.com/opencord/voltha-go/db |
| 10 | ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka |
| 11 | ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter |
| 12 | ADD tests/afrouter $GOPATH/src/github.com/opencord/voltha-go/tests/afrouter |
| 13 | |
| 14 | # Copy required proto files |
| 15 | # ... VOLTHA proos |
| 16 | # Repeat here even if it's done in the base |
| 17 | ADD protos/*.proto /src/protos/ |
| 18 | ADD protos/scripts/* /src/protos/ |
| 19 | ADD afrouter/arouter.json /src/ |
| 20 | ADD tests/afrouter/suites/* /src/suites/ |
| 21 | ADD tests/afrouter/arouter_test.json /src/ |
| 22 | |
| 23 | # |
| 24 | # Copy generated executables here |
| 25 | WORKDIR $GOPATH/src/github.com/opencord/voltha-go |
| 26 | |
| 27 | # Compile protobuf files |
| 28 | # Repeat here even if it's done in the base |
| 29 | RUN sh /src/protos/build_protos.sh /src/protos |
sslobodr | 1d1e50b | 2019-03-14 09:17:40 -0400 | [diff] [blame] | 30 | #RUN find / -name "*.pb.go" -print |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 31 | |
| 32 | #ADD /src/protos/voltha.pb test/afrouter/suites |
| 33 | # Build rw_core |
| 34 | RUN cd afrouter && go build -o /src/afrouter |
| 35 | #RUN ls -l /src/protos |
| 36 | RUN cp /src/protos/voltha.pb tests/afrouter/suites |
| 37 | RUN cd tests/afrouter && go build -o /src/afrouterTest |
| 38 | RUN mkdir /src/tests |
sslobodr | 1d1e50b | 2019-03-14 09:17:40 -0400 | [diff] [blame] | 39 | RUN cd tests/afrouter/suites && /src/afrouterTest -config main.json -logLevel 1 |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 40 | RUN mkdir /src/temp |
| 41 | RUN cp -r tests/afrouter/tests /src/temp |
| 42 | #RUN cd tests/afrouter/tester && go build -o /src/tests |
| 43 | |
| 44 | # ------------- |
| 45 | # Image creation stage |
| 46 | |
| 47 | FROM alpine:3.6 |
| 48 | |
| 49 | # Set the working directory |
| 50 | WORKDIR /app/src |
| 51 | WORKDIR /app |
| 52 | |
| 53 | # Copy required files |
| 54 | COPY --from=build-env /src/afrouter /app/ |
| 55 | COPY --from=build-env /src/afrouterTest /app/ |
| 56 | COPY --from=build-env /src/arouter.json /app/ |
| 57 | COPY --from=build-env /src/arouter_test.json /app/ |
| 58 | COPY --from=build-env /src/protos/voltha.pb /app/ |
sslobodr | 1d1e50b | 2019-03-14 09:17:40 -0400 | [diff] [blame] | 59 | COPY --from=build-env /src/suites/ /app/suites/ |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 60 | COPY --from=build-env /src/tests /app |
| 61 | COPY --from=build-env /src/temp/ /app/src/ |
sslobodr | 1d1e50b | 2019-03-14 09:17:40 -0400 | [diff] [blame] | 62 | COPY --from=build-env /go/src/github.com/opencord/voltha-go/protos/ /app/protos/ |
sslobodr | d6e07e7 | 2019-01-31 16:07:20 -0500 | [diff] [blame] | 63 | WORKDIR /app |
| 64 | |
| 65 | #CMD cd /app && ./arouter -config config/arouter.voltha2.json |
| 66 | |
| 67 | # Set the config volume |
| 68 | |