-
Notifications
You must be signed in to change notification settings - Fork 17
/
dockerRunnerDev.sh
executable file
·32 lines (23 loc) · 1.08 KB
/
dockerRunnerDev.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
#!/bin/bash
# Handle closing application on signal interrupt (ctrl + c)
trap 'kill $CONTINUOUS_BUILD_PID $SERVER_PID; gradle --stop; exit' INT
export TOKEN_BASE_URI=http://localhost:9015
mkdir logs
# Reset log file content for new application boot
echo "*** Logs for 'gradle installBootDist --continuous' ***" > ./logs/builder.log
echo "*** Logs for 'gradle bootRun' ***" > ./logs/runner.log
# Print that the application is starting in watch mode
echo "starting application in watch mode..."
# Start the continious build listener process
echo "starting continuous build listener..."
gradle installBootDist --continuous 2>&1 | tee ./logs/builder.log & CONTINUOUS_BUILD_PID=$!
# Start server process once initial build finishes
( while ! grep -m1 'BUILD SUCCESSFUL' < ./logs/builder.log; do
sleep 1
done
echo "starting application server in debug mode..."
gradle bootRun -Pdebug --args='debug' 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!
# Handle application background process exiting
wait $CONTINUOUS_BUILD_PID $SERVER_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."