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 MAINTAINER Balazs Szekeres <balazs.szekeres@nokia.com>
20 ARG go_install_dir="/usr/local/go"
22 ENV PATH="$go_install_dir/bin:$PATH"
27 && apk add --update libcap \
28 && adduser -u 145 -D -H -s /sbin/nologin kubedns \
29 && mkdir -p /home/kubedns \
30 && chown -R kubedns:kubedns /home/kubedns \
31 && chown -R kubedns:kubedns /etc \
32 && apk add --no-cache --virtual .build-deps build-base git mercurial go glide bash tar curl \
33 && apk add --no-cache dnsmasq \
34 && mkdir -p $go_install_dir \
35 && curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
36 && cd ${go_install_dir}/src/ \
38 && mkdir -p $GOPATH/src/k8s.io/dns \
39 && curl -fsSL -k https://github.com/kubernetes/dns/archive/${KUBEDNS_VERSION}.tar.gz | tar zx --strip-components=1 -C $GOPATH/src/k8s.io/dns \
40 && cd $GOPATH/src/k8s.io/dns \
41 && if [ $(uname -m) == 'aarch64' ]; then HOST_ARCH=arm64; else HOST_ARCH=amd64; ARCH_SUBDIR=linux_amd64; fi \
42 && PKG=k8s.io/dns ARCH=${HOST_ARCH} VERSION=${KUBEDNS_VERSION} ./build/build.sh \
43 && mv $GOPATH/bin/${ARCH_SUBDIR:-}/kube-dns /usr/bin/kube-dns \
44 && mv $GOPATH/bin/${ARCH_SUBDIR:-}/dnsmasq-nanny /usr/bin/dnsmasq-nanny \
45 && setcap 'cap_net_bind_service=+ep' /usr/sbin/dnsmasq \
46 && apk del .build-deps \
48 && rm -rf $go_install_dir \
50 && rm -rf /root/.glide
53 ENV HOME /home/kubedns