CI: Migrate Sonar Scan job to GHA
[it/dev.git] / bldr-imgs / bldr-ubuntu22-c-go / Dockerfile
1 # O-RAN-SC
2 #
3 # Copyright (C) 2019-2020 AT&T Intellectual Property and Nokia
4 # Copyright (C) 2023 Abhijit Gadgil.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # Builder image with superset of CI tools for RIC components
19
20 FROM nexus3.o-ran-sc.org:10001/ubuntu:22.04
21
22 ARG DEBIAN_FRONTEND=noninteractive
23
24 RUN apt-get update && apt-get install -y \
25     alien \
26     autoconf \
27     autoconf-archive \
28     automake \
29     autotools-dev \
30     build-essential \
31     cmake \
32     g++  \
33     gcc \
34     git \
35     ksh \
36     libbz2-dev \
37     libicu-dev \
38     libsctp-dev \
39     libtool \
40     lksctp-tools \
41     make \
42     python3-dev \
43     pkg-config \
44     software-properties-common \
45     sudo \
46     wget \
47     zlib1g \
48     zlib1g-dev \
49     zip \
50     libboost-all-dev
51
52 WORKDIR /tmp
53
54 # Install go versions in /opt
55 RUN mkdir -p /opt/go
56
57
58 ARG g18="1.18.10"
59 RUN wget -nv https://dl.google.com/go/go${g18}.linux-amd64.tar.gz \
60     && tar -xf go${g18}.linux-amd64.tar.gz \
61     && mv go /opt/go/1.18 \
62     && rm -f go*.gz
63
64 ARG g19="1.19.12"
65 RUN wget -nv https://dl.google.com/go/go${g19}.linux-amd64.tar.gz \
66     && tar -xf go${g19}.linux-amd64.tar.gz \
67     && mv go /opt/go/1.19 \
68     && rm -f go*.gz
69
70 ARG g20="1.20.7"
71 RUN wget -nv https://dl.google.com/go/go${g20}.linux-amd64.tar.gz \
72     && tar -xf go${g20}.linux-amd64.tar.gz \
73     && mv go /opt/go/1.20 \
74     && rm -f go*.gz
75
76 # Use /opt/go/1.18/bin for version 1.18.x (default)
77 ARG GOVERSION=1.18
78 ENV GOPATH=/root/go
79 ENV DEFAULTPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
80 ENV PATH=$DEFAULTPATH:/usr/local/go/bin:/opt/go/${GOVERSION}/bin:$GOPATH/bin
81
82 # This installs go-acc to GOPATH
83 RUN go version; \
84     export GOBIN=/usr/local/bin/; export GO111MODULE=on;\
85     go install github.com/ory/go-acc@master \
86     && go-acc --help
87
88
89 # sonar-scanner is not available in ubuntu repo
90 ARG sv="4.8.0.2856"
91 RUN wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sv}-linux.zip \
92     && unzip sonar-scanner-cli-${sv}-linux.zip \
93     && mv sonar-scanner-${sv}-linux /usr/local/sonar-scanner \
94     && rm -f sonar*.zip
95
96 # golangci-lint is not available in ubuntu repo
97 RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.53.3 \
98     && rm -f install.sh