mirror of
https://github.com/pacnpal/simpleguardhome.git
synced 2025-12-20 04:21:13 -05:00
feat(docker): add entrypoint script for graceful shutdown and application start
This commit is contained in:
23
docker-entrypoint.sh
Normal file
23
docker-entrypoint.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Function to handle termination signals
|
||||
handle_term() {
|
||||
echo "Received SIGTERM/SIGINT, shutting down gracefully..."
|
||||
kill -TERM "$child"
|
||||
wait "$child"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Set up signal handlers
|
||||
trap handle_term SIGTERM SIGINT
|
||||
|
||||
# Start the application
|
||||
echo "Starting SimpleGuardHome server..."
|
||||
python -m simpleguardhome.main &
|
||||
|
||||
# Store child PID
|
||||
child=$!
|
||||
|
||||
# Wait for process to complete
|
||||
wait "$child"
|
||||
Reference in New Issue
Block a user