blob: 5fe1dc231b34b92dd015f676e19099075f15a674 [file] [log] [blame]
# -------------
# Build stage
FROM base AS build-env
# Copy files
ADD rw_core $GOPATH/src/github.com/opencord/voltha-go/rw_core
ADD common $GOPATH/src/github.com/opencord/voltha-go/common
ADD db $GOPATH/src/github.com/opencord/voltha-go/db
ADD kafka $GOPATH/src/github.com/opencord/voltha-go/kafka
ADD afrouter $GOPATH/src/github.com/opencord/voltha-go/afrouter
ADD tests/afrouter $GOPATH/src/github.com/opencord/voltha-go/tests/afrouter
# Copy required proto files
# ... VOLTHA proos
# Repeat here even if it's done in the base
ADD protos/*.proto /src/protos/
ADD protos/scripts/* /src/protos/
ADD afrouter/arouter.json /src/
ADD tests/afrouter/suites/* /src/suites/
ADD tests/afrouter/arouter_test.json /src/
#
# Copy generated executables here
WORKDIR $GOPATH/src/github.com/opencord/voltha-go
# Compile protobuf files
# Repeat here even if it's done in the base
RUN sh /src/protos/build_protos.sh /src/protos
#ADD /src/protos/voltha.pb test/afrouter/suites
# Build rw_core
RUN cd afrouter && go build -o /src/afrouter
#RUN ls -l /src/protos
RUN cp /src/protos/voltha.pb tests/afrouter/suites
RUN cd tests/afrouter && go build -o /src/afrouterTest
RUN mkdir /src/tests
RUN cd tests/afrouter/suites && /src/afrouterTest -config main.json
RUN mkdir /src/temp
RUN cp -r tests/afrouter/tests /src/temp
#RUN cd tests/afrouter/tester && go build -o /src/tests
# -------------
# Image creation stage
FROM alpine:3.6
# Set the working directory
WORKDIR /app/src
WORKDIR /app
# Copy required files
COPY --from=build-env /src/afrouter /app/
COPY --from=build-env /src/afrouterTest /app/
COPY --from=build-env /src/arouter.json /app/
COPY --from=build-env /src/arouter_test.json /app/
COPY --from=build-env /src/protos/voltha.pb /app/
COPY --from=build-env /src/suites /app
COPY --from=build-env /src/tests /app
COPY --from=build-env /src/temp/ /app/src/
WORKDIR /app
#CMD cd /app && ./arouter -config config/arouter.voltha2.json
# Set the config volume