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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 ADD centos-7-docker.tar.xz /
18 MAINTAINER Krisztian Lengyel <krisztian.lengyel@nokia.com>
21 ARG components="danm fakeipam"
25 ARG go_install_dir="/usr/local/go"
26 ARG glide_install_dir="/usr/local/glide"
27 ENV PATH $GOPATH/bin:$go_install_dir/bin:$glide_install_dir:$PATH
30 ARG code_generator_version="kubernetes-1.13.4"
31 ARG build_packages="gcc gcc-c++ glibc-devel make autoconf git which libtool"
32 ARG danm_dependencies="iptables socat grep findutils curl conntrack-tools iputils"
36 RUN mkdir -p $GOPATH/bin \
37 && mkdir -p $GOPATH/src
39 RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
40 && yum install -y --setopt=skip_missing_names_on_install=False \
42 ${danm_dependencies} \
46 && mkdir -p ${go_install_dir} \
47 && if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; fi \
48 && 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} \
49 && glide_version="$(curl -sSLf https://glide.sh/version)" \
50 && mkdir -p ${glide_install_dir} \
51 && 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} \
52 && mkdir -p $GOPATH/src/github.com/nokia \
53 && git clone https://github.com/nokia/danm.git $GOPATH/src/github.com/nokia/danm \
54 && cd $GOPATH/src/github.com/nokia/danm \
56 && git checkout ${DANM_VERSION} \
57 && glide install --strip-vendor \
58 && go get -d github.com/vishvananda/netlink \
59 && go get github.com/containernetworking/plugins/pkg/ns \
60 && go get github.com/golang/groupcache/lru \
61 && rm -rf $GOPATH/src/k8s.io/code-generator \
62 && git clone -b ${code_generator_version} --depth 1 https://github.com/kubernetes/code-generator.git $GOPATH/src/k8s.io/code-generator \
63 && go install k8s.io/code-generator/cmd/deepcopy-gen \
64 && go install k8s.io/code-generator/cmd/client-gen \
65 && go install k8s.io/code-generator/cmd/lister-gen \
66 && go install k8s.io/code-generator/cmd/informer-gen \
67 && deepcopy-gen --alsologtostderr --input-dirs github.com/nokia/danm/crd/apis/danm/v1 -O zz_generated.deepcopy --bounding-dirs github.com/nokia/danm/crd/apis \
68 && client-gen --alsologtostderr --clientset-name versioned --input-base "" --input github.com/nokia/danm/crd/apis/danm/v1 --clientset-path github.com/nokia/danm/crd/client/clientset \
69 && lister-gen --alsologtostderr --input-dirs github.com/nokia/danm/crd/apis/danm/v1 --output-package github.com/nokia/danm/crd/client/listers \
70 && informer-gen --alsologtostderr --input-dirs github.com/nokia/danm/crd/apis/danm/v1 --versioned-clientset-package github.com/nokia/danm/crd/client/clientset/versioned --listers-package github.com/nokia/danm/crd/client/listers --output-package github.com/nokia/danm/crd/client/informers \
71 && mkdir -p ${binaries} \
72 && for component in $components; do \
73 go install -a -ldflags '-extldflags "-static"' github.com/nokia/danm/cmd/${component}; \
74 cp $GOPATH/bin/${component} ${binaries}/${component}; \