Update Dockerfile
Browse files- 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=
|
| 37 |
-
CMD python3 -c "import requests; requests.get('http://localhost:
|
| 38 |
|
| 39 |
# Expose port 7860 (Hugging Face Spaces default)
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
# Start server with production settings
|
| 43 |
-
|
|
|
|
| 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 |
|