From 338a0ac1f7f9fe76793babebe78c64be8e391052 Mon Sep 17 00:00:00 2001
From: Junqiu Lei <junqiu@amazon.com>
Date: Wed, 26 Jun 2024 11:22:31 -0700
Subject: [PATCH 1/2] Enable DYNAMIC_ARCH for x64 openblas build

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
---
 .../current/build.al2.opensearch.x64.arm64.dockerfile      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile b/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
index d34d1fb34c..f201bf2802 100644
--- a/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
+++ b/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
@@ -104,7 +104,12 @@ ENV CXX=g++
 RUN yum repolist && yum install lapack -y
 RUN git clone -b v0.3.27 --single-branch https://github.com/xianyi/OpenBLAS.git && \
     cd OpenBLAS && \
-    make USE_OPENMP=1 FC=gfortran && \
+    if [ "$(uname -m)" = "x86_64" ]; then \
+        echo "Machine is x86_64. Adding DYNAMIC_ARCH=1 to openblas make command."; \
+        make USE_OPENMP=1 FC=gfortran DYNAMIC_ARCH=1; \
+    else \
+        make USE_OPENMP=1 FC=gfortran; \
+    fi && \
     make PREFIX=/usr/local install
 ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
 RUN pip3 install cmake==3.23.3

From 931027dad045771257d5de9c8eb645f0d0588da2 Mon Sep 17 00:00:00 2001
From: Junqiu Lei <junqiu@amazon.com>
Date: Wed, 26 Jun 2024 11:53:18 -0700
Subject: [PATCH 2/2] Install compatible public_suffix gem version for fpm

Signed-off-by: Junqiu Lei <junqiu@amazon.com>
---
 .../current/build.al2.opensearch.x64.arm64.dockerfile           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile b/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
index f201bf2802..34b23cf1ff 100644
--- a/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
+++ b/docker/ci/dockerfiles/current/build.al2.opensearch.x64.arm64.dockerfile
@@ -119,6 +119,6 @@ USER $CONTAINER_USER
 WORKDIR $CONTAINER_USER_HOME
 
 # Install fpm for opensearch dashboards core
-RUN gem install dotenv -v 2.8.1 && gem install fpm -v 1.14.2
+RUN gem install dotenv -v 2.8.1 && gem install public_suffix -v 5.1.1 && gem install fpm -v 1.14.2
 ENV PATH=$CONTAINER_USER_HOME/.gem/gems/fpm-1.14.2/bin:$PATH
 RUN fpm -v