Files
cve_monitor/docker-entrypoint.sh
Mateusz Gruszczyński bc1b4279de first commit
2026-02-13 12:42:53 +01:00

62 lines
1.4 KiB
Bash

#!/bin/sh
set -e
mkdir -p /app/cve_db /app/logs
chmod -R 777 /app/cve_db /app/logs
WORKERS=${WORKERS:-4}
WORKER_TIMEOUT=${WORKER_TIMEOUT:-120}
PORT=${PORT:-5000}
echo "======================================"
echo "CVE Monitor Docker Container"
echo "======================================"
case "$1" in
app)
echo "Starting Flask app with Gunicorn..."
echo " Workers: $WORKERS"
echo " Timeout: $WORKER_TIMEOUT"
echo " Port: $PORT"
echo "======================================"
exec gunicorn \
--bind 0.0.0.0:$PORT \
--workers $WORKERS \
--timeout $WORKER_TIMEOUT \
--access-logfile - \
--error-logfile - \
--log-level info \
app:app
;;
scheduler)
echo "Starting CVE Scheduler..."
echo "======================================"
exec python scheduler.py
;;
discord)
echo "Starting Discord Bot..."
echo "======================================"
exec python discord_bot.py
;;
update)
echo "Running manual CVE update..."
echo "======================================"
exec python -c "from cve_handler import update_all_vendors; update_all_vendors(force=True)"
;;
shell)
echo "Starting interactive shell..."
echo "======================================"
exec /bin/sh
;;
*)
echo "Executing custom command: $@"
echo "======================================"
exec "$@"
;;
esac