-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·40 lines (35 loc) · 913 Bytes
/
dev.sh
File metadata and controls
executable file
·40 lines (35 loc) · 913 Bytes
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
#!/bin/bash
set -e
# Function to clean up background processes on exit
cleanup() {
echo "Cleaning up..."
pkill -f "sam local start-api" || true
kill $(jobs -p) 2>/dev/null || true
}
# Set up cleanup on script exit
trap cleanup EXIT
# Initial build
echo "Initial build..."
./gradlew clean build
sam build
# Start SAM in the background
echo "Starting SAM API..."
sam local start-api \
--docker-network backend_sam-local \
--env-vars env.json \
--warm-containers LAZY &
# Watch for changes and rebuild
echo "Watching for changes..."
while true; do
fswatch -1 src/
echo "Changes detected, rebuilding..."
./gradlew build
sam build
pkill -f "sam local start-api" || true
echo "Restarting SAM API..."
sam local start-api \
--docker-network backend_sam-local \
--env-vars env.json \
--warm-containers LAZY &
echo "Ready for more changes..."
done