blob: 5fbfc1240553c6ec8784730fc0e79fec8d6c497b [file] [log] [blame]
# -------------
# Build stage
FROM base AS build-env
WORKDIR $GOPATH/src/github.com/opencord/voltha-go
# Copy files
COPY rw_core ./rw_core
COPY afrouter ./afrouter
COPY tests/afrouter ./tests/afrouter
COPY tests/afrouter /build/tests
# Copy proto files
COPY vendor/ $GOPATH/src
# Copy config and runtime protobuf needed for routing
RUN cp afrouter/arouter.json /build/tests/suites/
RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/
# Build
RUN cd afrouter && go build --tags integration -o /build/afrouter
RUN cd tests/afrouter && go build --tags integration -o /build/afrouterTest
# Run tests
RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1
# -------------
# Image creation stage
FROM alpine:3.9
# Set the working directory
WORKDIR /app
# Copy required files
COPY --from=build-env /build/afrouter /app/tests/
COPY --from=build-env /build/afrouterTest /app/tests/
COPY --from=build-env /build/tests/suites/arouter.json /app/
COPY --from=build-env /build/tests/suites/voltha.pb /app/tests/
COPY --from=build-env /build/tests /app/tests/
COPY --from=build-env /src/tests /app/tests/
CMD tests/runAll tests