Added seed code for caas-etcd.
[ta/caas-etcd.git] / docker-build / etcd / 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 alpine:3.9
16 MAINTAINER Krisztian Lengyel <krisztian.lengyel@nokia.com>
17
18 ARG ETCD_VERSION
19 ENV GOPATH /build
20
21 COPY get-package build-pip /usr/bin/
22 COPY source-list.txt ${GOPATH}/
23
24
25 COPY rootfs/ /
26
27 RUN apk add py-pip \
28 &&  pip install --upgrade pip \
29 &&  mkdir -p ${GOPATH} \
30 &&  chmod 755 /usr/bin/build-pip /usr/bin/get-package \
31 \
32 &&  adduser -u 143 -D -H -s /sbin/nologin caas_etcd \
33 &&  chmod +x /etcdctl3 \
34 &&  chmod 644 ${GOPATH}/source-list.txt \
35 \
36 &&  apk add --no-cache --virtual .build-deps go godep curl tar build-base py-setuptools python2-dev \
37 &&  apk add --no-cache python2 py2-ipaddress py2-dnspython \
38 \
39 &&  build-pip python-urllib3 python-etcd \
40 \
41 &&  mkdir -p ${GOPATH}/src/github.com/coreos/etcd \
42 &&  curl -fsSL -k https://github.com/coreos/etcd/archive/v${ETCD_VERSION}.tar.gz | tar zx --strip-components=1 -C ${GOPATH}/src/github.com/coreos/etcd \
43 &&  cd ${GOPATH}/src/github.com/coreos/etcd \
44 &&  GOOS=linux ./build \
45 &&  mv bin/etcd /usr/bin/ \
46 &&  mv bin/etcdctl /usr/bin/ \
47 &&  mv /etcdctl3 /usr/bin/ \
48 \
49 &&  apk del .build-deps \
50 &&  rm -rf ${GOPATH} \
51 &&  rm -rf /build
52
53
54 WORKDIR /