AArch64 support
[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 scratch
16 ADD centos-7-docker.tar.xz /
17 CMD ["/bin/bash"]
18 MAINTAINER Krisztian Lengyel <krisztian.lengyel@nokia.com>
19
20 ARG SRIOV_VERSION
21 ARG go_version
22 ARG binaries
23 ENV GOPATH /go
24 ARG go_install_dir="/usr/local/go"
25 ARG glide_install_dir="/usr/local/glide"
26 ENV PATH="$GOPATH/bin:$go_install_dir/bin:$glide_install_dir:$PATH"
27 ENV CGO_ENABLED=0
28 ENV GOOS=linux
29 ARG build_packages="gcc gcc-c++ glibc-devel make autoconf git which libtool curl"
30
31 WORKDIR /
32
33 RUN mkdir -p $GOPATH/bin \
34 &&  mkdir -p $GOPATH/src
35
36 RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
37 &&  yum install -y --setopt=skip_missing_names_on_install=False \
38       ${build_packages} \
39       ${danm_dependencies} \
40       bash \
41       golang \
42 &&    set -x \
43 &&  mkdir -p ${go_install_dir} \
44 &&  if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \
45 &&  curl -fsSL -k https://dl.google.com/go/go${go_version}.linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
46 &&  glide_version="$(curl -sSLf https://glide.sh/version)" \
47 &&  mkdir -p ${glide_install_dir} \
48 &&  curl -fsSL https://github.com/Masterminds/glide/releases/download/${glide_version}/glide-${glide_version}-linux-${HOST_ARCH}.tar.gz | tar zx --strip-components=1 -C ${glide_install_dir} \
49 &&  mkdir -p ${binaries} \
50 #
51 # Get Flannel
52 #
53 &&  go get -v github.com/containernetworking/plugins/plugins/meta/flannel \
54 &&  cp ${GOPATH}/bin/flannel ${binaries} \
55 #
56 # Build sriov-cni
57 #
58 &&  mkdir -p ${GOPATH}/src/github.com/intel/ \
59 &&  cd ${GOPATH}/src/github.com/intel/ \
60 &&  git clone https://github.com/intel/sriov-cni.git \
61 &&  cd ${GOPATH}/src/github.com/intel/sriov-cni \
62 &&  git checkout ${SRIOV_VERSION} \
63 &&  make \
64 &&  cp $GOPATH/src/github.com/intel/sriov-cni/build/sriov ${binaries}