3d21db2af7523e0271a2e1ee8634226eacf4591d
[ci-management.git] / docker / bldr-ubuntu18-c-go / Dockerfile
1 # O-RAN-SC
2 #
3 # Copyright (C) 2019-2020 AT&T Intellectual Property and Nokia
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Builder image with superset of CI tools for RIC components
18
19 FROM nexus3.o-ran-sc.org:10001/ubuntu:18.04
20
21 RUN apt-get update && apt-get install -y \
22     autoconf \
23     autoconf-archive \
24     automake \
25     autotools-dev \
26     build-essential \
27     g++  \
28     gcc \
29     git \
30     libbz2-dev \
31     libicu-dev \
32     libsctp-dev \
33     libtool \
34     lksctp-tools \
35     make \
36     python-dev \
37     pkg-config \
38     software-properties-common \
39     wget \
40     zlib1g \
41     zlib1g-dev \
42     zlibc \
43     zip
44
45 WORKDIR /tmp
46
47 # Install go versions in /opt
48 RUN mkdir -p /opt/go
49
50 ARG g12="1.12.16"
51 RUN wget -nv https://dl.google.com/go/go${g12}.linux-amd64.tar.gz \
52     && tar -xf go${g12}.linux-amd64.tar.gz \
53     && mv go /opt/go/1.12 \
54     && rm -f go*.gz
55
56 ARG g13="1.13.7"
57 RUN wget -nv https://dl.google.com/go/go${g13}.linux-amd64.tar.gz \
58     && tar -xf go${g13}.linux-amd64.tar.gz \
59     && mv go /opt/go/1.13 \
60     && rm -f go*.gz
61
62 ENV GOPATH=/root/go
63 # Default path has go version 1.12.x
64 # Use /opt/go/1.13/bin for version 1.13.x
65 ENV PATH=$PATH:/opt/go/1.12/bin:$GOPATH/bin
66
67 # This installs go-acc to GOPATH
68 RUN go version \
69     && go get -v github.com/ory/go-acc \
70     && go-acc --help
71
72 # install a recent version of cmake, ubuntu repo version is old
73 ARG cv="3.14.5"
74 RUN wget -nv https://github.com/Kitware/CMake/releases/download/v${cv}/cmake-${cv}-Linux-x86_64.sh \
75     && chmod +x cmake-${cv}-Linux-x86_64.sh \
76     && ./cmake-${cv}-Linux-x86_64.sh --prefix=/usr/local --skip-license \
77     && rm -f cmake*.sh
78
79 # install a recent version of ninja-build, ubuntu repo version is old
80 RUN wget -nv https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip \
81     && unzip ninja-linux.zip \
82     && chmod +x ninja \
83     && mv ninja /usr/local/bin \
84     && rm -f ninja*.zip
85
86 # sonar-scanner is not available in ubuntu repo
87 ARG sv="4.2.0.1873"
88 RUN wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sv}-linux.zip \
89     && unzip sonar-scanner-cli-${sv}-linux.zip \
90     && mv sonar-scanner-${sv}-linux /usr/local/sonar-scanner \
91     && rm -f sonar*.zip
92
93 # golangci-lint is not available in ubuntu repo
94 RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $GOPATH/bin v1.23.6 \
95     && rm -f install.sh
96
97 # NNG repo is not frequently tagged so it's pinned to a commit hash.
98 # This commit provides fix to the proxy-reconnect
99 # bug that we identified:  https://github.com/nanomsg/nng/issues/970
100 RUN git clone https://github.com/nanomsg/nng.git \
101     && cd nng \
102     && git checkout e618abf8f3db2a94269a79c8901a51148d48fcc2 \
103     && mkdir build \
104     && cd build \
105     && cmake -DBUILD_SHARED_LIBS=1 -G Ninja .. \
106     && ninja \
107     && ninja install \
108     && cd ../.. \
109     && rm -rf nng
110
111 # install a recent version of boost, ubuntu repo version is old
112 ARG bv="1_69_0"
113 RUN wget -nv https://dl.bintray.com/boostorg/release/1.69.0/source/boost_${bv}.zip \
114     && unzip -q boost_${bv}.zip \
115     && cd boost_${bv} \
116     && ./bootstrap.sh --prefix=/usr/ \
117     && ./b2 \
118     && ./b2 install \
119     && cd ../ \
120     && rm -rf boost*.zip boost_${bv}