Spaces:
Sleeping
Sleeping
| # Start Redis in the background | |
| echo "Lancement de Redis..." | |
| redis-server --daemonize yes | |
| sleep 2 | |
| # Start the Celery worker in the background | |
| echo "Lancement du worker Celery..." | |
| # We use python -m here as it's reliable for background tasks | |
| python -m celery -A tasks.worker_celery:celery_app worker --loglevel=info & | |
| # Start the FastAPI API in the background | |
| echo "Lancement de l'API FastAPI..." | |
| python -m uvicorn main:app --host 0.0.0.0 --port 8000 & | |
| # --- THE DEFINITIVE FIX --- | |
| # 1. Change to the application directory. This is the crucial step. | |
| cd /app || exit | |
| # 2. Execute Gunicorn. 'exec' replaces the shell process with the gunicorn process. | |
| # This is the main process of the container. | |
| echo "Lancement de l'application Flask depuis le dossier /app..." | |
| exec python -m gunicorn --bind 0.0.0.0:7860 --workers 1 --threads 8 --timeout 120 app:app |