blob: 8d0f956ab925552ada8308450fb6448d9fa9c36b [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
22RUN cd afrouter && go build -o /build/afrouter
23RUN cd tests/afrouter && go build -o /build/afrouterTest
24
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
Matt Jeanneret85ab5082019-04-01 11:29:20 -040037COPY --from=build-env /build/afrouter /app/
38COPY --from=build-env /build/afrouterTest /app/
David Bainbridge142516e2019-04-19 01:34:58 +000039COPY --from=build-env /build/tests/suites/arouter.json /app/
40COPY --from=build-env /build/tests/suites/voltha.pb /app
Matt Jeanneret85ab5082019-04-01 11:29:20 -040041COPY --from=build-env /build/tests /app/tests/
sslobodrd6e07e72019-01-31 16:07:20 -050042