Newer go version 1.13 and above support
[ric-plt/xapp-frame.git] / ci / Dockerfile
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 #
18 #----------------------------------------------------------
19
20 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as xapp-base
21
22 ARG g16="1.16.4"
23 RUN wget -nv https://dl.google.com/go/go${g16}.linux-amd64.tar.gz \
24     && tar -xf go${g16}.linux-amd64.tar.gz \
25     && mv go /opt/go/1.16 \
26     && rm -f go*.gz
27
28 RUN apt-get update -y \
29     &&apt-get install -y \
30     apt-utils \
31     cmake \
32     gawk \
33     sudo \
34     nano \
35     jq \
36     gettext-base \
37     bison \
38     flex \
39     curl \
40     tree
41
42 ARG GOVERSION=1.16
43 ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/go/${GOVERSION}/bin
44
45 RUN curl -s https://packagecloud.io/install/repositories/o-ran-sc/master/script.deb.sh | bash
46
47 # RMR
48 ARG RMRVERSION=4.2.2
49 #RUN apt-get install -y rmr=${RMRVERSION} rmr-dev=${RMRVERSION}
50 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr_${RMRVERSION}_amd64.deb
51 RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMRVERSION}_amd64.deb/download.deb && dpkg -i rmr-dev_${RMRVERSION}_amd64.deb
52 RUN rm -f rmr_${RMRVERSION}_amd64.deb rmr-dev_${RMRVERSION}_amd64.deb
53
54 #
55 RUN ldconfig
56
57 #
58 ENV PATH="/usr/local/go/bin:${PATH}"
59
60 WORKDIR "/"
61 CMD ["/bin/bash"]
62
63 #----------------------------------------------------------
64 #
65 #----------------------------------------------------------
66 FROM xapp-base as xapp-base-testbuild
67
68
69 RUN mkdir -p /ws
70 WORKDIR "/ws"
71
72 # Module prepare (if go.mod/go.sum updated)
73 COPY go.mod /ws
74 COPY go.sum /ws
75 RUN go mod download
76
77 # Copy
78 COPY . /ws
79
80 # Build
81 RUN make -C /ws go-build
82
83 # Test fmt
84 RUN make -C /ws go-test-fmt
85
86 # Test Requires dbaas
87 #RUN sed -r  "s/^(::1.*)/#\1/" /etc/hosts  > /etc/hosts.new \
88 #    && cat /etc/hosts.new > /etc/hosts \
89 #    && cat /etc/hosts  \
90 #    && make -C /ws go-test
91
92 RUN  make -C /ws go-test