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 | |
| 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 |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 11 | ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter |
| 12 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 13 | # Copy required proto files |
| 14 | # ... VOLTHA proos |
sslobodr | 2fb98b8 | 2019-01-21 09:29:51 -0500 | [diff] [blame] | 15 | # Repeat here even if it's done in the base |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 16 | ADD protos/*.proto /src/protos/ |
| 17 | ADD protos/scripts/* /src/protos/ |
| 18 | ADD afrouter/arouter.json /src |
| 19 | |
| 20 | # |
| 21 | # Copy generated executables here |
| 22 | WORKDIR $GOPATH/src/github.com/opencord/voltha-go |
| 23 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 24 | # Compile protobuf files |
sslobodr | 2fb98b8 | 2019-01-21 09:29:51 -0500 | [diff] [blame] | 25 | # Repeat here even if it's done in the base |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 26 | RUN sh /src/protos/build_protos.sh /src/protos |
| 27 | |
| 28 | # Build rw_core |
| 29 | RUN cd afrouter && go build -o /src/afrouter |
| 30 | |
sslobodr | a3ea7d4 | 2019-01-16 15:03:16 -0500 | [diff] [blame] | 31 | # ------------- |
| 32 | # Image creation stage |
| 33 | |
| 34 | FROM alpine:3.6 |
| 35 | |
| 36 | # Set the working directory |
| 37 | WORKDIR /app |
| 38 | |
| 39 | # Copy required files |
| 40 | COPY --from=build-env /src/afrouter /app/ |
| 41 | COPY --from=build-env /src/arouter.json /app/ |
| 42 | COPY --from=build-env /src/protos/voltha.pb /app/ |
| 43 | WORKDIR config |
| 44 | WORKDIR /app |
| 45 | |
| 46 | #CMD cd /app && ./arouter -config config/arouter.voltha2.json |
| 47 | |
| 48 | # Set the config volume |
| 49 | |