-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·89 lines (73 loc) · 1.87 KB
/
run.sh
File metadata and controls
executable file
·89 lines (73 loc) · 1.87 KB
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
#!/bin/bash
# Default values
EXEC=1
TESTS=0
VERBOSE=0
DEBUG=0
PREDICT=0
DISTIMAGE=0
CLEAR=0
BACKGROUND=""
set -e
show_help() {
echo "Usage: $0 [-x] [-b] [-d] [-s] [-t] [-i] [-c] [-v] [-h]"
echo " -x: Execute the application (default if no command line option specified)"
echo " -b: Run in background"
echo " -d: Run application in debug mode"
echo " -s: Run a shell instead of running the application"
echo " -t: Run application tests"
echo " -i: Build dist image"
echo " -c: Clear docker environment"
echo " -v: Verbose output"
echo " -h: Show this help"
}
while getopts xp:bdsticvh flag
do
case "${flag}" in
x) EXEC=1;;
p) PREDICT=1 PREDICT_ARG=${OPTARG};;
b) BACKGROUND=" -d ";;
d) DEBUG=1;;
s) EXEC=0;;
t) TESTS=1;;
i) DISTIMAGE=1;;
c) CLEAR=1;;
v) VERBOSE=1;;
h) show_help; exit 0;;
esac
done
if [ $VERBOSE -eq 1 ]; then
set -x
fi
if [ $DISTIMAGE -eq 1 ]; then
# Build dist image
docker build --pull -f .build/dockerfiles/Dockerfile -t dist .
exit 0
fi
if [ $CLEAR -eq 1 ]; then
# Clear docker environment
docker compose stop
exit 0
fi
# Build docker containers
docker compose build --pull --build-arg FIX_UID="$(id -u)" --build-arg FIX_GID="$(id -g)"
# Start docker environment
docker compose up -d
docker restart dnsdock || true
if [ $TESTS -eq 1 ]; then
# Run tests
docker compose exec app /bin/bash -c "mvn clean test"
exit 0
fi
if [ $DEBUG -eq 1 ]; then
# Run application in debug mode
docker compose exec app /bin/bash -c "MAVEN_OPTS=\"\${DEBUG_OPTS}\" mvn clean compile exec:java"
exit 0
fi
if [ $EXEC -eq 1 ]; then
# Run application
docker compose exec ${BACKGROUND} app /bin/bash -c "mvn clean compile exec:java"
else
# Log into container
docker compose exec app /bin/bash
fi