rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vongosl...@apache.org
Subject [rocketmq-docker] 15/50: fix(Dockerfile): add cmds to find JAVA_HOME
Date Tue, 03 Dec 2019 13:50:38 GMT
This is an automated email from the ASF dual-hosted git repository.

vongosling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-docker.git

commit e2e389e5a5c7f3b10c5012a3af5e338e18f4d14d
Author: liuruiyiyang <245422695@qq.com>
AuthorDate: Mon Aug 5 13:45:22 2019 +0800

    fix(Dockerfile): add cmds to find JAVA_HOME
---
 image-build/Dockerfile                     |  9 +++------
 image-build/scripts/runbroker-customize.sh | 14 ++++++++++++++
 image-build/scripts/runserver-customize.sh | 14 ++++++++++++++
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/image-build/Dockerfile b/image-build/Dockerfile
index d890715..9303516 100644
--- a/image-build/Dockerfile
+++ b/image-build/Dockerfile
@@ -44,16 +44,13 @@ ENV ROCKETMQ_VERSION ${version}
 # Rocketmq home
 ENV ROCKETMQ_HOME  /home/rocketmq/rocketmq-${ROCKETMQ_VERSION}
 
-# Java home
-ENV JAVA_HOME  /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64
-
 WORKDIR  ${ROCKETMQ_HOME}
 
 RUN set -eux; \
-    curl -s https://dist.apache.org/repos/dist/release/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip
-o rocketmq.zip; \
-    curl -s https://dist.apache.org/repos/dist/release/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip.asc
-o rocketmq.zip.asc; \
+    curl https://dist.apache.org/repos/dist/release/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip
-o rocketmq.zip; \
+    curl https://dist.apache.org/repos/dist/release/rocketmq/${ROCKETMQ_VERSION}/rocketmq-all-${ROCKETMQ_VERSION}-bin-release.zip.asc
-o rocketmq.zip.asc; \
     #https://www.apache.org/dist/rocketmq/KEYS
-	curl -s https://www.apache.org/dist/rocketmq/KEYS -o KEYS; \
+	curl https://www.apache.org/dist/rocketmq/KEYS -o KEYS; \
 	\
 	gpg --import KEYS; \
     gpg --batch --verify rocketmq.zip.asc rocketmq.zip ; \
diff --git a/image-build/scripts/runbroker-customize.sh b/image-build/scripts/runbroker-customize.sh
index 8afa1ed..cf82645 100755
--- a/image-build/scripts/runbroker-customize.sh
+++ b/image-build/scripts/runbroker-customize.sh
@@ -24,6 +24,20 @@ error_exit ()
     exit 1
 }
 
+find_java_home()
+{
+    case "`uname`" in
+        Darwin)
+            JAVA_HOME=$(/usr/libexec/java_home)
+        ;;
+        *)
+            JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
+        ;;
+    esac
+}
+
+find_java_home
+
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
 [ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in
your environment, We need java(x64)!"
diff --git a/image-build/scripts/runserver-customize.sh b/image-build/scripts/runserver-customize.sh
index dd25b1a..7135b6b 100755
--- a/image-build/scripts/runserver-customize.sh
+++ b/image-build/scripts/runserver-customize.sh
@@ -24,6 +24,20 @@ error_exit ()
     exit 1
 }
 
+find_java_home()
+{
+    case "`uname`" in
+        Darwin)
+            JAVA_HOME=$(/usr/libexec/java_home)
+        ;;
+        *)
+            JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
+        ;;
+    esac
+}
+
+find_java_home
+
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=$HOME/jdk/java
 [ ! -e "$JAVA_HOME/bin/java" ] && JAVA_HOME=/usr/java
 [ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in
your environment, We need java(x64)!"


Mime
View raw message