Commit ·
486653f
1
Parent(s): ade7b32
Add gunicorn with 2 workers for better concurrent request handling
Browse files- Dockerfile +11 -2
- requirements.txt +1 -0
- services/prompt.txt +0 -0
Dockerfile
CHANGED
|
@@ -17,5 +17,14 @@ COPY . .
|
|
| 17 |
# Expose port 7860 (Hugging Face default)
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
# Run
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Expose port 7860 (Hugging Face default)
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
+
# Run with gunicorn + uvicorn workers for better concurrency
|
| 21 |
+
# - 2 workers for CPU hardware (adjust based on available cores)
|
| 22 |
+
# - 120s timeout for long video generation
|
| 23 |
+
# - graceful timeout for clean shutdown
|
| 24 |
+
CMD ["gunicorn", "main:app", \
|
| 25 |
+
"--workers", "2", \
|
| 26 |
+
"--worker-class", "uvicorn.workers.UvicornWorker", \
|
| 27 |
+
"--bind", "0.0.0.0:7860", \
|
| 28 |
+
"--timeout", "300", \
|
| 29 |
+
"--graceful-timeout", "120", \
|
| 30 |
+
"--keep-alive", "5"]
|
requirements.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
fastapi==0.109.0
|
| 2 |
uvicorn==0.27.0
|
|
|
|
| 3 |
python-multipart==0.0.6
|
| 4 |
httpx==0.26.0
|
| 5 |
boto3==1.34.0
|
|
|
|
| 1 |
fastapi==0.109.0
|
| 2 |
uvicorn==0.27.0
|
| 3 |
+
gunicorn==21.2.0
|
| 4 |
python-multipart==0.0.6
|
| 5 |
httpx==0.26.0
|
| 6 |
boto3==1.34.0
|
services/prompt.txt
ADDED
|
File without changes
|