madiator-docker-runpod/official-templates/better-ai-launcher/pre_start.sh

18 lines
484 B
Bash
Raw Normal View History

2024-10-12 14:46:41 +02:00
#!/bin/bash
set -e
# Set Flask environment variables
export FLASK_ENV=production
# Use APP_PATH environment variable if set, otherwise use a default
APP_PATH=${APP_PATH:-"/app/app.py"}
# Extract the directory and filename
APP_DIR=$(dirname "$APP_PATH")
APP_FILE=$(basename "$APP_PATH")
# Change to the app directory
cd "$APP_DIR"
# Start Gunicorn with your Flask app
exec gunicorn --bind 0.0.0.0:7223 --worker-class gevent --workers 1 "${APP_FILE%.*}:app" # Changed port to 7223