Signed-off-by: Cao Xueliang caoxl78320@163.com --- container/etcd/Dockerfile | 9 +++++---- container/etcd/build | 11 ++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/container/etcd/Dockerfile b/container/etcd/Dockerfile index f4746ab..1612dbd 100644 --- a/container/etcd/Dockerfile +++ b/container/etcd/Dockerfile @@ -6,12 +6,13 @@ FROM alpine:3.13 MAINTAINER Cao Xueliang caoxl78320@163.com
ARG VERSION +ARG ARCH 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://repo.huaweicloud.com/etcd/$%7BVERSION%7D/etcd-$%7BVERSION%7D-linux-a... && \ - tar zxvf etcd-${VERSION}-linux-arm64.tar.gz && \ - mv etcd-${VERSION}-linux-arm64/etcd* /bin/ && \ - rm -Rf etcd-${VERSION}-linux-arm64* /var/cache/apk/* + wget https://repo.huaweicloud.com/etcd/$%7BVERSION%7D/etcd-$%7BVERSION%7D-linux-$... && \ + tar zxvf etcd-${VERSION}-linux-${ARCH}.tar.gz && \ + mv etcd-${VERSION}-linux-${ARCH}/etcd* /bin/ && \ + rm -Rf etcd-${VERSION}-linux-${ARCH}* /var/cache/apk/*
VOLUME /data
diff --git a/container/etcd/build b/container/etcd/build index 37c2326..58def3d 100755 --- a/container/etcd/build +++ b/container/etcd/build @@ -4,7 +4,12 @@
. ../defconfig.sh
-version=v3.4.15 -docker_skip_rebuild "etcd-${version}:alpine" +VERSION=v3.4.15 +docker_skip_rebuild "etcd-${VERSION}:alpine"
-docker build -t etcd-${version}:alpine --build-arg VERSION=${version} . +[ "$(arch)" == "aarch64" ] && ARCH=arm64 +[ "$(arch)" == "x86_64" ] && ARCH=amd64 + +docker_skip_rebuild "etcd-${VERSION}:alpine" + +docker build -t etcd-${VERSION}:alpine --build-arg VERSION=${VERSION} --build-arg ARCH=${ARCH} .