-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerRunnerDev.sh
executable file
·28 lines (22 loc) · 1007 Bytes
/
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
#!/bin/bash
# Handle closing application on signal interrupt (ctrl + c)
trap 'kill $CONTINUOUS_BUILD_PID $SERVER_PID; gradle --stop; exit' INT
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 build --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 crd server..."
gradle bootRun 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..."