a9d13e8f65de3f3bef80fc6b164f8807c05d5440
[ta/caas-danm.git] / docker-build / cni-builder / Dockerfile
1 # Copyright 2019 Nokia
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 FROM centos:7.6.1810
16 MAINTAINER Krisztian Lengyel <krisztian.lengyel@nokia.com>
17
18 ARG SRIOV_VERSION
19 ARG go_version
20 ARG binaries
21 ENV GOPATH /go
22 ARG go_install_dir="/usr/local/go"
23 ARG glide_install_dir="/usr/local/glide"
24 ENV PATH="$GOPATH/bin:$go_install_dir/bin:$glide_install_dir:$PATH"
25 ENV CGO_ENABLED=0
26 ENV GOOS=linux
27 ARG build_packages="gcc gcc-c++ glibc-devel make autoconf git which libtool curl"
28
29 WORKDIR /
30
31 RUN mkdir -p $GOPATH/bin \
32 &&  mkdir -p $GOPATH/src
33
34 RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
35 &&  yum install -y --setopt=skip_missing_names_on_install=False \
36       ${build_packages} \
37       ${danm_dependencies} \
38       bash \
39       golang \
40 &&    set -x \
41 &&  mkdir -p ${go_install_dir} \
42 &&  curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-amd64.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
43 &&  glide_version="$(curl -sSLf https://glide.sh/version)" \
44 &&  mkdir -p ${glide_install_dir} \
45 &&  curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-amd64.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \
46 &&  mkdir -p ${binaries} \
47 #
48 # Get Flannel
49 #
50 &&  go get -v github.com/containernetworking/plugins/plugins/meta/flannel \
51 &&  cp ${GOPATH}/bin/flannel ${binaries} \
52 #
53 # Build sriov-cni
54 #
55 &&  mkdir -p ${GOPATH}/src/github.com/intel/ \
56 &&  cd ${GOPATH}/src/github.com/intel/ \
57 &&  git clone https://github.com/intel/sriov-cni.git \
58 &&  cd ${GOPATH}/src/github.com/intel/sriov-cni \
59 &&  git checkout ${SRIOV_VERSION} \
60 &&  make \
61 &&  cp $GOPATH/src/github.com/intel/sriov-cni/build/sriov ${binaries}