forked from Intel-bigdata/SSM
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-images.sh
executable file
·95 lines (82 loc) · 3.19 KB
/
build-images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
set -e
SSM_APP_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
SSM_APP_VERSION=$(echo "${SSM_APP_VERSION}" | head -1)
SSM_SERVER_IMAGE_VERSION=${SSM_APP_VERSION:-*}
while [ $# -gt 0 ]; do
case "$1" in
--cluster=*)
CLUSTER_TYPE="${1#*=}"
;;
--hadoop=*)
HADOOP_PROFILE="${1#*=}"
;;
*)
echo "=========================================================="
echo " Error: Invalid argument. Should be in the form --key=arg."
echo " Supported arguments:"
echo " --cluster: multihost (default) | singlehost"
echo " --hadoop: 3.3 (default)"
echo "=========================================================="
exit 1
esac
shift
done
CLUSTER_TYPE=${CLUSTER_TYPE:-multihost}
HADOOP_PROFILE=${HADOOP_PROFILE:-3.3}
case $HADOOP_PROFILE in
3.3)
HADOOP_VERSION=3.3.6
;;
*)
echo "Unknown Hadoop profile ${HADOOP_PROFILE}"
exit 1;
;;
esac
if type -p java; then
echo found java executable in PATH
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo found java executable in JAVA_HOME
_java="$JAVA_HOME/bin/java"
else
echo "ERROR: no java"
exit 1
fi
if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo version "$version"
if [[ "$version" != "1.8"* ]]; then
echo "ERROR: java must be 1.8+ version"
exit 1
fi
fi
echo "=============================="
echo " Rebuild the project "
echo "=============================="
mvn clean package -Pdist,web-ui,hadoop-${HADOOP_PROFILE} -DskipTests
echo "========================================================"
echo " Build Hadoop ${HADOOP_VERSION} with SSM image "
echo "========================================================"
case $CLUSTER_TYPE in
singlehost)
docker build -f ./supports/tools/docker/singlehost/Dockerfile -t cloud-hub.adsw.io/library/ssm-hadoop:${HADOOP_VERSION} \
--build-arg="SSM_APP_VERSION=${SSM_APP_VERSION}" \
--build-arg="HADOOP_VERSION=${HADOOP_VERSION}" .
;;
multihost)
docker build -f ./supports/tools/docker/multihost/Dockerfile-hadoop-base -t cloud-hub.adsw.io/library/hadoop-base:${HADOOP_VERSION} \
--build-arg="HADOOP_VERSION=${HADOOP_VERSION}" \
--build-arg="SSM_APP_VERSION=${SSM_APP_VERSION}" .
docker build -f ./supports/tools/docker/multihost/kerberos/Dockerfile-kdc -t cloud-hub.adsw.io/library/ssm-kdc-server:${HADOOP_VERSION} .
docker build -f ./supports/tools/docker/multihost/ldap/Dockerfile-samba -t hub.adsw.io/qa-samba/samba:demo .
docker build -f ./supports/tools/docker/multihost/datanode/Dockerfile-hadoop-datanode -t cloud-hub.adsw.io/library/hadoop-datanode:${HADOOP_VERSION} .
docker build -f ./supports/tools/docker/multihost/namenode/Dockerfile-hadoop-namenode -t cloud-hub.adsw.io/library/hadoop-namenode:${HADOOP_VERSION} .
docker build -f ./supports/tools/docker/multihost/ssm/Dockerfile-ssm-server -t cloud-hub.adsw.io/library/ssm-server:"${SSM_SERVER_IMAGE_VERSION}" \
--build-arg="SSM_APP_VERSION=${SSM_APP_VERSION}" .
;;
*)
echo "Unknown cluster type ${CLUSTER_TYPE}"
exit 1;
;;
esac