[atlas] 02/02: ATLAS-4795: docker setup updated to support Apple M1

2023-09-11 Thread madhan
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 368c90dfe35cf552e619dc1c69e9caa4c64b9497
Author: Madhan Neethiraj 
AuthorDate: Fri Sep 8 12:46:22 2023 -0700

ATLAS-4795: docker setup updated to support Apple M1

(cherry picked from commit 3786524112d02951ac6a059085d303de2649e835)
---
 dev-support/atlas-docker/.env  | 18 --
 dev-support/atlas-docker/Dockerfile|  5 -
 dev-support/atlas-docker/Dockerfile.atlas  |  5 +
 dev-support/atlas-docker/Dockerfile.atlas-base | 11 ---
 dev-support/atlas-docker/Dockerfile.atlas-build|  6 ++
 dev-support/atlas-docker/docker-compose.atlas-base.yml |  3 +++
 .../atlas-docker/docker-compose.atlas-build.yml|  2 ++
 dev-support/atlas-docker/docker-compose.atlas.yml  |  2 ++
 dev-support/atlas-docker/scripts/atlas-build.sh|  2 ++
 9 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/dev-support/atlas-docker/.env b/dev-support/atlas-docker/.env
index 623f0477c..c50ed6093 100644
--- a/dev-support/atlas-docker/.env
+++ b/dev-support/atlas-docker/.env
@@ -1,10 +1,24 @@
 BUILD_HOST_SRC=true
 SKIPTESTS=true
 GIT_URL=https://github.com/apache/atlas.git
-BRANCH=release-2.3.0
+BRANCH=branch-2.0
 PROFILE=dist,external-hbase-solr
 
-ATLAS_VERSION=2.3.0
+# Java version for AtlasBase image.
+# This image gets used as base docker image for all images.
+# Valid values: 8, 11, 17
+ATLAS_BASE_JAVA_VERSION=8
+
+# Java version to use to build Apache Atlas
+# Valid values: 8, 11, 17
+ATLAS_BUILD_JAVA_VERSION=8
+
+# Java version to use to run Atlas server
+# Valid values: 8, 11, 17
+ATLAS_SERVER_JAVA_VERSION=8
+
+ATLAS_VERSION=2.4.0-SNAPSHOT
+UBUNTU_VERSION=20.04
 HADOOP_VERSION=3.3.0
 HBASE_VERSION=2.3.3
 KAFKA_VERSION=2.8.1
diff --git a/dev-support/atlas-docker/Dockerfile 
b/dev-support/atlas-docker/Dockerfile
index 7bd79651f..12c1b6ea2 100644
--- a/dev-support/atlas-docker/Dockerfile
+++ b/dev-support/atlas-docker/Dockerfile
@@ -16,12 +16,15 @@
 
 FROM ubuntu:18.04
 
+ARG TARGETARCH
+ARG ATLAS_BASE_JAVA_VERSION
+
 # Install Git, which is missing from the Ubuntu base images.
 RUN apt-get update && apt-get install -y git python
 
 # Install Java.
 RUN apt-get update && apt-get install -y openjdk-8-jdk
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_BASE_JAVA_VERSION}-openjdk-${TARGETARCH}
 
 # Install Maven.
 
diff --git a/dev-support/atlas-docker/Dockerfile.atlas 
b/dev-support/atlas-docker/Dockerfile.atlas
index 888779133..83550c5f1 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas
+++ b/dev-support/atlas-docker/Dockerfile.atlas
@@ -16,7 +16,12 @@
 
 FROM atlas-base:latest
 
+ARG ATLAS_SERVER_JAVA_VERSION
 ARG ATLAS_VERSION
+ARG TARGETARCH
+
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_SERVER_JAVA_VERSION}-openjdk-${TARGETARCH}
+RUN update-java-alternatives --set 
/usr/lib/jvm/java-1.${ATLAS_SERVER_JAVA_VERSION}.0-openjdk-${TARGETARCH}
 
 COPY ./scripts/atlas.sh ${ATLAS_SCRIPTS}/
 COPY ./dist/apache-atlas-${ATLAS_VERSION}-server.tar.gz /home/atlas/dist/
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-base 
b/dev-support/atlas-docker/Dockerfile.atlas-base
index e68daa69d..4aa225c16 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-base
+++ b/dev-support/atlas-docker/Dockerfile.atlas-base
@@ -14,21 +14,26 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM ubuntu:20.04
+ARG UBUNTU_VERSION
+FROM ubuntu:${UBUNTU_VERSION}
 
+ARG TARGETARCH
+ARG ATLAS_BASE_JAVA_VERSION
 
 # Install tzdata, Python, Java
 RUN apt-get update && \
 DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \
-python python3 python3-pip openjdk-8-jdk bc iputils-ping ssh pdsh
+python python3 python3-pip openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk bc 
iputils-ping ssh pdsh
 
 # Set environment variables
-ENV JAVA_HOME  /usr/lib/jvm/java-8-openjdk-amd64
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_BASE_JAVA_VERSION}-openjdk-${TARGETARCH}
 ENV ATLAS_DIST/home/atlas/dist
 ENV ATLAS_HOME/opt/atlas
 ENV ATLAS_SCRIPTS /home/atlas/scripts
 ENV PATH  
/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
+RUN update-java-alternatives --set 
/usr/lib/jvm/java-1.${ATLAS_BASE_JAVA_VERSION}.0-openjdk-${TARGETARCH}
+
 
 # setup groups, users, directories
 RUN groupadd atlas && \
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-build 
b/dev-support/atlas-docker/Dockerfile.atlas-build
index 4b381c1d9..42a2536ee 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-build
+++ b/dev-support/atlas-docker/Dockerfile.atlas-build
@@ -16,14 +16,20 @@
 
 FROM atlas-base:latest
 
+ARG ATLAS_BUILD_JAVA_VERSION
+ARG TARGETARCH
+
 
 # Install necessary packages 

[atlas] 02/02: ATLAS-4795: docker setup updated to support Apple M1

2023-09-11 Thread madhan
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 3786524112d02951ac6a059085d303de2649e835
Author: Madhan Neethiraj 
AuthorDate: Fri Sep 8 12:46:22 2023 -0700

ATLAS-4795: docker setup updated to support Apple M1
---
 dev-support/atlas-docker/.env   | 14 ++
 dev-support/atlas-docker/Dockerfile |  5 -
 dev-support/atlas-docker/Dockerfile.atlas   |  5 +
 dev-support/atlas-docker/Dockerfile.atlas-base  | 11 ---
 dev-support/atlas-docker/Dockerfile.atlas-build |  6 ++
 dev-support/atlas-docker/docker-compose.atlas-base.yml  |  3 +++
 dev-support/atlas-docker/docker-compose.atlas-build.yml |  2 ++
 dev-support/atlas-docker/docker-compose.atlas.yml   |  2 ++
 dev-support/atlas-docker/scripts/atlas-build.sh |  2 ++
 9 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/dev-support/atlas-docker/.env b/dev-support/atlas-docker/.env
index 440be2a46..0e924b27a 100644
--- a/dev-support/atlas-docker/.env
+++ b/dev-support/atlas-docker/.env
@@ -4,7 +4,21 @@ GIT_URL=https://github.com/apache/atlas.git
 BRANCH=master
 PROFILE=dist,external-hbase-solr
 
+# Java version for AtlasBase image.
+# This image gets used as base docker image for all images.
+# Valid values: 8, 11, 17
+ATLAS_BASE_JAVA_VERSION=8
+
+# Java version to use to build Apache Atlas
+# Valid values: 8, 11, 17
+ATLAS_BUILD_JAVA_VERSION=8
+
+# Java version to use to run Atlas server
+# Valid values: 8, 11, 17
+ATLAS_SERVER_JAVA_VERSION=8
+
 ATLAS_VERSION=3.0.0-SNAPSHOT
+UBUNTU_VERSION=20.04
 HADOOP_VERSION=3.3.0
 HBASE_VERSION=2.3.3
 KAFKA_VERSION=2.8.1
diff --git a/dev-support/atlas-docker/Dockerfile 
b/dev-support/atlas-docker/Dockerfile
index 7bd79651f..12c1b6ea2 100644
--- a/dev-support/atlas-docker/Dockerfile
+++ b/dev-support/atlas-docker/Dockerfile
@@ -16,12 +16,15 @@
 
 FROM ubuntu:18.04
 
+ARG TARGETARCH
+ARG ATLAS_BASE_JAVA_VERSION
+
 # Install Git, which is missing from the Ubuntu base images.
 RUN apt-get update && apt-get install -y git python
 
 # Install Java.
 RUN apt-get update && apt-get install -y openjdk-8-jdk
-ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_BASE_JAVA_VERSION}-openjdk-${TARGETARCH}
 
 # Install Maven.
 
diff --git a/dev-support/atlas-docker/Dockerfile.atlas 
b/dev-support/atlas-docker/Dockerfile.atlas
index 888779133..83550c5f1 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas
+++ b/dev-support/atlas-docker/Dockerfile.atlas
@@ -16,7 +16,12 @@
 
 FROM atlas-base:latest
 
+ARG ATLAS_SERVER_JAVA_VERSION
 ARG ATLAS_VERSION
+ARG TARGETARCH
+
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_SERVER_JAVA_VERSION}-openjdk-${TARGETARCH}
+RUN update-java-alternatives --set 
/usr/lib/jvm/java-1.${ATLAS_SERVER_JAVA_VERSION}.0-openjdk-${TARGETARCH}
 
 COPY ./scripts/atlas.sh ${ATLAS_SCRIPTS}/
 COPY ./dist/apache-atlas-${ATLAS_VERSION}-server.tar.gz /home/atlas/dist/
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-base 
b/dev-support/atlas-docker/Dockerfile.atlas-base
index e68daa69d..4aa225c16 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-base
+++ b/dev-support/atlas-docker/Dockerfile.atlas-base
@@ -14,21 +14,26 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM ubuntu:20.04
+ARG UBUNTU_VERSION
+FROM ubuntu:${UBUNTU_VERSION}
 
+ARG TARGETARCH
+ARG ATLAS_BASE_JAVA_VERSION
 
 # Install tzdata, Python, Java
 RUN apt-get update && \
 DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata \
-python python3 python3-pip openjdk-8-jdk bc iputils-ping ssh pdsh
+python python3 python3-pip openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk bc 
iputils-ping ssh pdsh
 
 # Set environment variables
-ENV JAVA_HOME  /usr/lib/jvm/java-8-openjdk-amd64
+ENV JAVA_HOME 
/usr/lib/jvm/java-${ATLAS_BASE_JAVA_VERSION}-openjdk-${TARGETARCH}
 ENV ATLAS_DIST/home/atlas/dist
 ENV ATLAS_HOME/opt/atlas
 ENV ATLAS_SCRIPTS /home/atlas/scripts
 ENV PATH  
/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
+RUN update-java-alternatives --set 
/usr/lib/jvm/java-1.${ATLAS_BASE_JAVA_VERSION}.0-openjdk-${TARGETARCH}
+
 
 # setup groups, users, directories
 RUN groupadd atlas && \
diff --git a/dev-support/atlas-docker/Dockerfile.atlas-build 
b/dev-support/atlas-docker/Dockerfile.atlas-build
index 4b381c1d9..42a2536ee 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-build
+++ b/dev-support/atlas-docker/Dockerfile.atlas-build
@@ -16,14 +16,20 @@
 
 FROM atlas-base:latest
 
+ARG ATLAS_BUILD_JAVA_VERSION
+ARG TARGETARCH
+
 
 # Install necessary packages to build Atlas
 RUN apt-get update && apt-get -y install git maven
 
 # Set environment variables
+ENV JAVA_HOME