Rox-Turbo commited on
Commit
5ff3439
·
verified ·
1 Parent(s): f2619c7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -4
Dockerfile CHANGED
@@ -32,13 +32,14 @@ USER user
32
  ENV PATH="/home/user/.local/bin:$PATH" \
33
  HOME="/home/user"
34
 
35
- # Health check
36
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
37
- CMD python3 -c "import requests; requests.get('http://localhost:7860/health', timeout=5)"
38
 
39
  # Expose port 7860 (Hugging Face Spaces default)
40
  EXPOSE 7860
41
 
42
  # Start server with production settings
43
- CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860} --log-level ${LOG_LEVEL:-info} --no-access-log --workers ${WEB_CONCURRENCY:-2}"]
 
44
 
 
32
  ENV PATH="/home/user/.local/bin:$PATH" \
33
  HOME="/home/user"
34
 
35
+ # Health check (respect Hugging Face PORT env)
36
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
37
+ CMD python3 -c "import os, requests; port=os.environ.get('PORT','7860'); requests.get(f'http://localhost:{port}/health', timeout=5)"
38
 
39
  # Expose port 7860 (Hugging Face Spaces default)
40
  EXPOSE 7860
41
 
42
  # Start server with production settings
43
+ # Note: default workers=1 is safer on low-memory HF hardware; override via WEB_CONCURRENCY.
44
+ CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860} --log-level ${LOG_LEVEL:-info} --no-access-log --workers ${WEB_CONCURRENCY:-1}"]
45