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 |
| 30 | |
| 31 | #ADD /src/protos/voltha.pb test/afrouter/suites |
| 32 | # Build rw_core |
| 33 | RUN cd afrouter && go build -o /src/afrouter |
| 34 | #RUN ls -l /src/protos |
| 35 | RUN cp /src/protos/voltha.pb tests/afrouter/suites |
| 36 | RUN cd tests/afrouter && go build -o /src/afrouterTest |
| 37 | RUN mkdir /src/tests |
| 38 | RUN cd tests/afrouter/suites && /src/afrouterTest -config main.json |
| 39 | RUN mkdir /src/temp |
| 40 | RUN cp -r tests/afrouter/tests /src/temp |
| 41 | #RUN cd tests/afrouter/tester && go build -o /src/tests |
| 42 | |
| 43 | # ------------- |
| 44 | # Image creation stage |
| 45 | |
| 46 | FROM alpine:3.6 |
| 47 | |
| 48 | # Set the working directory |
| 49 | WORKDIR /app/src |
| 50 | WORKDIR /app |
| 51 | |
| 52 | # Copy required files |
| 53 | COPY --from=build-env /src/afrouter /app/ |
| 54 | COPY --from=build-env /src/afrouterTest /app/ |
| 55 | COPY --from=build-env /src/arouter.json /app/ |
| 56 | COPY --from=build-env /src/arouter_test.json /app/ |
| 57 | COPY --from=build-env /src/protos/voltha.pb /app/ |
| 58 | COPY --from=build-env /src/suites /app |
| 59 | COPY --from=build-env /src/tests /app |
| 60 | COPY --from=build-env /src/temp/ /app/src/ |
| 61 | WORKDIR /app |
| 62 | |
| 63 | #CMD cd /app && ./arouter -config config/arouter.voltha2.json |
| 64 | |
| 65 | # Set the config volume |
| 66 | |