26d0ccbfa04044073c9e4f313658bb49dfd99c46
[ric-plt/appmgr.git] / Dockerfile.tests
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #   Copyright (c) 2019 Nokia.
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15
16 #----------------------------------------------------------
17 FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu-c-go-nng:3-u16.04-nng1.1.1 AS appmgr-build
18
19 RUN apt-get update -y  &&  apt-get install -y jq
20
21 ENV PATH="/usr/local/go/bin:${PATH}"
22 ARG HELMVERSION=v2.13.0-rc.1
23 ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
24
25 #
26 # helm
27 #
28 RUN wget https://storage.googleapis.com/kubernetes-helm/helm-${HELMVERSION}-linux-amd64.tar.gz \
29     && tar -zxvf helm-${HELMVERSION}-linux-amd64.tar.gz \
30     && cp linux-amd64/helm /usr/local/bin/helm \
31     && rm -rf helm-${HELMVERSION}-linux-amd64.tar.gz \
32     && rm -rf linux-amd64
33
34 # Install kubectl from Docker Hub.
35 COPY --from=lachlanevenson/k8s-kubectl:v1.10.3 /usr/local/bin/kubectl /usr/local/bin/kubectl
36
37 RUN mkdir -p /go/src/${PACKAGEURL}
38 WORKDIR "/go/src/${PACKAGEURL}"
39 ENV GOPATH="/go"
40
41 # Module prepare (if go.mod/go.sum updated)
42 COPY go.mod /go/src/${PACKAGEURL}
43 COPY go.sum /go/src/${PACKAGEURL}
44 RUN GO111MODULE=on go mod download
45
46 # build
47 COPY . /go/src/${PACKAGEURL}
48 RUN make -C /go/src/${PACKAGEURL} build
49
50 CMD ["/bin/bash"]
51
52 #----------------------------------------------------------
53 FROM appmgr-build as appmgr-test_unit
54 ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
55 WORKDIR "/go/src/${PACKAGEURL}"
56 CMD ["make","go-test"]
57
58 #----------------------------------------------------------
59 FROM appmgr-build as appmgr-test_fmt
60 ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
61 WORKDIR "/go/src/${PACKAGEURL}"
62 CMD ["make","go-test-fmt"]
63
64 #----------------------------------------------------------
65 FROM appmgr-build as appmgr-test_sanity
66 ARG PACKAGEURL=gerrit.o-ran-sc.org/r/ric-plt/appmgr
67 WORKDIR "/go/src/${PACKAGEURL}"
68 CMD ["jq","-s",".", "api/appmgr_rest_api.json"]