Browse Source

:wrench: add env arg for docker

Jeremy Zheng 1 năm trước cách đây
mục cha
commit
804de446ff
2 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 1 1
      docker/open-search/Dockerfile
  2. 6 1
      docker/open-search/build.sh

+ 1 - 1
docker/open-search/Dockerfile

@@ -16,8 +16,8 @@ RUN update-alternatives --set editor /usr/bin/vim.basic
 RUN mkdir -p $HOME/downloads
 
 # https://opensearch.org/downloads.html#opensearch
+ARG OPENSEARCH_ARCH
 ENV OPENSEARCH_VERSION "2.17.0"
-ENV OPENSEARCH_ARCH "arm64"
 ENV OPENSEARCH_JAVA_HOME "/opt/opensearch-${OPENSEARCH_VERSION}/jdk"
 RUN wget -q -P $HOME/downloads \
     https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-${OPENSEARCH_ARCH}.tar.gz

+ 6 - 1
docker/open-search/build.sh

@@ -5,8 +5,13 @@ set -e
 export VERSION=$(date "+%4Y%m%d%H%M%S")
 export CODE="mint-open-search"
 
+if [ "$#" -ne 1 ]; then
+    echo "USAGE: $0 OPENSEARCH_ARCH"
+    exit 1
+fi
+
 podman pull ubuntu:latest
-podman build -t $CODE .
+podman build --build-arg OPENSEARCH_ARCH=$1 -t $CODE .
 podman save --format=oci-archive -o $CODE-$VERSION.tar $CODE
 md5sum $CODE-$VERSION.tar >$CODE-$VERSION.md5