-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
58 lines (54 loc) · 1.5 KB
/
start.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
#!/usr/bin/env bash
MAN="Usage: $(basename "$0") [-h|f|c] [-p proxyurl] -- starts container and deploys application
where:
-h show this help
-f force rebuild
-c copy assets
-p use proxy with url <proxyurl>"
REBUILD="false"
COPYASSETS="false"
PROXYBASE=""
WARFILE=./SWBP/target/SWBP-5.0-SNAPSHOT.war
ENCODING=iso8859-1
ASSETSFOLDER=SWBP/src/main/webapp/swbadmin/jsp/process
EXPANDEDAPPROOT=target/tomcat.8080/webapps/expanded
while getopts ":hfcp:" opt; do
case $opt in
f)
REBUILD="true"
;;
p)
PROXYBASE="--proxy-base-url $OPTARG"
;;
h)
echo "$MAN"
exit 0;
;;
c)
COPYASSETS="true"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Argument missing for option -$OPTARG." >&2
exit 1
;;
esac
done
if [ "$REBUILD" = "true" ]; then
echo "Recompiling project..."
sh ./install.sh
fi
if [ ! -e "$WARFILE" ]; then
echo "WAR file not found. Run start.sh -f."
else
echo "Starting container..."
if [ "$COPYASSETS" = "true" ]; then
cp -r $ASSETSFOLDER target/tomcat.8080/webapps/expanded/swbadmin/jsp/process
java -Dfile.encoding=$ENCODING -jar target/dependency/webapp-runner.jar $PROXYBASE $EXPANDEDAPPROOT
else
java -Dfile.encoding=$ENCODING -jar target/dependency/webapp-runner.jar $PROXYBASE $WARFILE
fi
fi