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 && PKG=k8s.io/dns ARCH=amd64 VERSION=${KUBEDNS_VERSION} ./build/build.sh \
42 && mv $GOPATH/bin/linux_amd64/kube-dns /usr/bin/kube-dns \
43 && mv $GOPATH/bin/linux_amd64/dnsmasq-nanny /usr/bin/dnsmasq-nanny \
44 && setcap 'cap_net_bind_service=+ep' /usr/sbin/dnsmasq \
45 && apk del .build-deps \
47 && rm -rf $go_install_dir \
49 && rm -rf /root/.glide
52 ENV HOME /home/kubedns