blob: 69179374308990ec21a562fab522506e5ccd8ae3 [file] [log] [blame]
sslobodrd6e07e72019-01-31 16:07:20 -05001# -------------
2# Build stage
3
4FROM base AS build-env
5
sslobodrd6e07e72019-01-31 16:07:20 -05006WORKDIR $GOPATH/src/github.com/opencord/voltha-go
7
Matt Jeanneret85ab5082019-04-01 11:29:20 -04008# Copy files
9COPY rw_core ./rw_core
10COPY afrouter ./afrouter
11COPY tests/afrouter ./tests/afrouter
12COPY tests/afrouter /build/tests
sslobodrd6e07e72019-01-31 16:07:20 -050013
Matt Jeanneret85ab5082019-04-01 11:29:20 -040014# Copy config and runtime protobuf needed for routing
15RUN cp afrouter/arouter.json /build/tests/suites/
16RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/
17
18# Build
19RUN cd afrouter && go build -o /build/afrouter
20RUN cd tests/afrouter && go build -o /build/afrouterTest
21
22# Run tests
23RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1
sslobodrd6e07e72019-01-31 16:07:20 -050024
25# -------------
26# Image creation stage
27
Matt Jeanneret85ab5082019-04-01 11:29:20 -040028FROM alpine:3.9
sslobodrd6e07e72019-01-31 16:07:20 -050029
30# Set the working directory
sslobodrd6e07e72019-01-31 16:07:20 -050031WORKDIR /app
32
33# Copy required files
Matt Jeanneret85ab5082019-04-01 11:29:20 -040034COPY --from=build-env /build/afrouter /app/
35COPY --from=build-env /build/afrouterTest /app/
36COPY --from=build-env /build/arouter.json /app/
37COPY --from=build-env /build/voltha.pb /app
38COPY --from=build-env /build/tests /app/tests/
sslobodrd6e07e72019-01-31 16:07:20 -050039
Matt Jeanneret85ab5082019-04-01 11:29:20 -040040ENTRYPOINT ["/app/afrouterTest"]