-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·62 lines (51 loc) · 1.8 KB
/
build.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
#!/bin/sh
echo "Starting kinsjen build script build.sh"
echo "Checking for node.js installation"
if which node > /dev/null
then
echo "node.js installed, found version: $(node -v)"
else
echo "node.js installation was not found"
echo "Install node.js before running this script"
exit 0
fi
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 "java installation was not found"
echo "Install java before running this script"
exit 0
fi
if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "java version = $version"
if [[ ! "$version" > "10" ]]; then
echo "java version must be 11 or higher"
exit 0
fi
fi
cd client/kinsjen
echo "Starting npm run build"
npm run build
echo "Removing src/main/resources/templates/"
rm -r ../../server/kinsjen/src/main/resources/templates/
mkdir ../../server/kinsjen/src/main/resources/templates/
echo "Removing src/main/resources/static/"
rm -r ../../server/kinsjen/src/main/resources/static/
echo "Copying all artifacts to src/main/resources/static/"
cp -r dist/kinsjen/browser/ ../../server/kinsjen/src/main/resources/static/
echo "Moving index.html from /static to /templates"
mv ../../server/kinsjen/src/main/resources/static/index.html ../../server/kinsjen/src/main/resources/templates/index.html
echo "Entering kinsjen server"
cd ../../server/kinsjen
echo "Running mvn clean install"
mvn clean install
echo "Building docker image"
docker build --build-arg KINSJEN_JAR=target/kinsjen.jar -t anshooarora/kinsjen -t anshooarora/kinsjen:0.1 .
# echo "Launching kinsjen jar from /target/"
# cd target
# java -jar kinsjen.jar -Dspring.profiles.active=h2