choose base image according to different arch.
arch: aarch64 => base image: elasticsearch:7.11.1@sha256:d52cda1e73d1b1915ba2d76ca1e426620c7b5d6942d9d2f432259503974ba786
arch: x86_64 => base image: elasticsearch:7.11.1
Signed-off-by: Liu Yinsi <liuyinsi(a)163.com>
---
container/es/Dockerfile | 3 ++-
container/es/build | 8 +++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/container/es/Dockerfile b/container/es/Dockerfile
index f29e677e..bc320076 100644
--- a/container/es/Dockerfile
+++ b/container/es/Dockerfile
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: MulanPSL-2.0+
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-FROM elasticsearch:7.11.1@sha256:d52cda1e73d1b1915ba2d76ca1e426620c7b5d6942d9d2f432259503974ba786
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE}
ARG MEMORY
ARG USER
diff --git a/container/es/build b/container/es/build
index e0232270..73593f4b 100755
--- a/container/es/build
+++ b/container/es/build
@@ -14,6 +14,12 @@ names = Set.new %w[
defaults = relevant_service_authentication(names)
docker_skip_rebuild "es:7.11.1"
+BASE_IMAGE_DICT = {
+ 'aarch64' => 'elasticsearch:7.11.1@sha256:d52cda1e73d1b1915ba2d76ca1e426620c7b5d6942d9d2f432259503974ba786',
+ 'x86_64' => 'elasticsearch:7.11.1' }.freeze
+
+BASE_IMAGE = BASE_IMAGE_DICT[%x(arch).chomp]
+
available_memory = get_available_memory
-system "docker build -t es:7.11.1 --build-arg MEMORY=#{available_memory} --build-arg USER=#{defaults['ES_USER']} --build-arg PASSWORD=#{defaults['ES_PASSWORD']} --network=host ."
+system "docker build -t es:7.11.1 --build-arg MEMORY=#{available_memory} --build-arg USER=#{defaults['ES_USER']} --build-arg PASSWORD=#{defaults['ES_PASSWORD']} --build-arg BASE_IMAGE=#{BASE_IMAGE} --network=host ."
--
2.23.0