mwauranjorogekelvin commited on
Commit
05bfdd2
·
verified ·
1 Parent(s): 09c8554

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -1
Dockerfile CHANGED
@@ -13,4 +13,13 @@ COPY app.py .
13
 
14
  EXPOSE 7860
15
 
16
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
13
 
14
  EXPOSE 7860
15
 
16
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
17
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')"
18
+
19
+ # Shell form so $WEB_CONCURRENCY is expanded at runtime (set to 4 in HF Spaces)
20
+ # uvicorn.workers.UvicornWorker = correct ASGI worker class for FastAPI + Gunicorn
21
+ CMD gunicorn app:app \
22
+ --workers ${WEB_CONCURRENCY:-4} \
23
+ --bind 0.0.0.0:7860 \
24
+ --timeout 120 \
25
+ --worker-class uvicorn.workers.UvicornWorker