blob: 5fbfc1240553c6ec8784730fc0e79fec8d6c497b [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
David Bainbridge142516e2019-04-19 01:34:58 +000014# Copy proto files
15COPY vendor/ $GOPATH/src
16
Matt Jeanneret85ab5082019-04-01 11:29:20 -040017# Copy config and runtime protobuf needed for routing
18RUN cp afrouter/arouter.json /build/tests/suites/
19RUN cp vendor/github.com/opencord/voltha-protos/go/voltha.pb /build/tests/suites/
20
21# Build
Kent Hagerman0ab4cb22019-04-24 13:13:35 -040022RUN cd afrouter && go build --tags integration -o /build/afrouter
23RUN cd tests/afrouter && go build --tags integration -o /build/afrouterTest
Matt Jeanneret85ab5082019-04-01 11:29:20 -040024
25# Run tests
26RUN cd /build/tests/suites && /build/afrouterTest -config main.json -logLevel 1
sslobodrd6e07e72019-01-31 16:07:20 -050027
28# -------------
29# Image creation stage
30
Matt Jeanneret85ab5082019-04-01 11:29:20 -040031FROM alpine:3.9
sslobodrd6e07e72019-01-31 16:07:20 -050032
33# Set the working directory
sslobodrd6e07e72019-01-31 16:07:20 -050034WORKDIR /app
35
36# Copy required files
Kent Hagermanf6516dd2019-05-09 15:49:55 -040037COPY --from=build-env /build/afrouter /app/tests/
38COPY --from=build-env /build/afrouterTest /app/tests/
David Bainbridge142516e2019-04-19 01:34:58 +000039COPY --from=build-env /build/tests/suites/arouter.json /app/
Kent Hagermanf6516dd2019-05-09 15:49:55 -040040COPY --from=build-env /build/tests/suites/voltha.pb /app/tests/
Matt Jeanneret85ab5082019-04-01 11:29:20 -040041COPY --from=build-env /build/tests /app/tests/
Kent Hagermanf6516dd2019-05-09 15:49:55 -040042COPY --from=build-env /src/tests /app/tests/
sslobodrd6e07e72019-01-31 16:07:20 -050043
Kent Hagermanf6516dd2019-05-09 15:49:55 -040044CMD tests/runAll tests