add etcd container Dockerfile, build and start script.
Signed-off-by: Cao Xueliang caoxl78320@163.com --- container/etcd/Dockerfile | 16 ++++++++++++++++ container/etcd/build | 12 ++++++++++++ container/etcd/start | 28 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 container/etcd/Dockerfile create mode 100755 container/etcd/build create mode 100755 container/etcd/start
diff --git a/container/etcd/Dockerfile b/container/etcd/Dockerfile new file mode 100644 index 0000000..3654fc4 --- /dev/null +++ b/container/etcd/Dockerfile @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +FROM alpine:3.13 + +MAINTAINER Cao Xueliang caoxl78320@163.com + +ARG VERSION +RUN sed -ri.origin 's|^https?://dl-cdn.alpinelinux.org|http://mirrors.huaweicloud.com%7Cg' /etc/apk/repositories && \ + apk update && apk add ca-certificates && \ + wget https://github.com/etcd-io/etcd/releases/download/$%7BVERSION%7D/etcd-$%7BVE... && \ + tar zxvf etcd-${VERSION}-linux-arm64.tar.gz && \ + mv etcd-${VERSION}-linux-arm64/etcd* /bin/ && \ + rm -Rf etcd-${VERSION}-linux-arm64* /var/cache/apk/* + +VOLUME /data diff --git a/container/etcd/build b/container/etcd/build new file mode 100755 index 0000000..6ae25dd --- /dev/null +++ b/container/etcd/build @@ -0,0 +1,12 @@ +#!/bin/sh +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +. ../defconfig.sh + +version=v3.4.15 +docker_skip_rebuild "etcd-${version}:alpine" + +docker build -t etcd-${version}:alpine --build-arg VERSION=${version} . + + diff --git a/container/etcd/start b/container/etcd/start new file mode 100755 index 0000000..7657b86 --- /dev/null +++ b/container/etcd/start @@ -0,0 +1,28 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +. $CCI_SRC/container/defconfig.sh + +docker_rm etcd-server + +cmd=( + docker run + -it + -p 2379:2379 + -p 2380:2380 + -p 4001:4001 + -p 7001:7001 + -v /srv/etcd/dir:/data + -e ETCD_UNSUPPORTED_ARCH=arm64 + --name etcd-server + etcd-v3.4.15:alpine + /bin/etcd + --name node-1 + --data-dir /data + --initial-cluster-state new + --listen-client-urls http://0.0.0.0:2379 + --advertise-client-urls http://0.0.0.0:2379 +) + +"${cmd[@]}"