Spaces:
Runtime error
Runtime error
Commit ·
3eeae84
1
Parent(s): 1ab43d1
Fix healthcheck to use correct port with PORT environment variable
Browse files- Dockerfile +4 -4
- environment/Dockerfile +7 -4
Dockerfile
CHANGED
|
@@ -74,11 +74,11 @@ ENV PATH="/app/.venv/bin:$PATH"
|
|
| 74 |
# Set PYTHONPATH so imports work correctly
|
| 75 |
ENV PYTHONPATH="/app/env:$PYTHONPATH"
|
| 76 |
|
| 77 |
-
# Health check
|
| 78 |
-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 79 |
-
CMD curl -f http://localhost:8000/health || exit 1
|
| 80 |
-
|
| 81 |
# Run the FastAPI server
|
| 82 |
# HF Spaces exposes port 7860; set to 8000 for local dev
|
| 83 |
ENV PORT=${PORT:-7860}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
CMD ["sh", "-c", "cd /app/env && uvicorn environment.app:app --host 0.0.0.0 --port ${PORT}"]
|
|
|
|
| 74 |
# Set PYTHONPATH so imports work correctly
|
| 75 |
ENV PYTHONPATH="/app/env:$PYTHONPATH"
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
# Run the FastAPI server
|
| 78 |
# HF Spaces exposes port 7860; set to 8000 for local dev
|
| 79 |
ENV PORT=${PORT:-7860}
|
| 80 |
+
|
| 81 |
+
# Health check (must be after PORT is set)
|
| 82 |
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 83 |
+
CMD curl -f http://localhost:${PORT}/health || exit 1
|
| 84 |
CMD ["sh", "-c", "cd /app/env && uvicorn environment.app:app --host 0.0.0.0 --port ${PORT}"]
|
environment/Dockerfile
CHANGED
|
@@ -71,10 +71,13 @@ ENV PATH="/app/.venv/bin:$PATH"
|
|
| 71 |
# Set PYTHONPATH so imports work correctly
|
| 72 |
ENV PYTHONPATH="/app/env:$PYTHONPATH"
|
| 73 |
|
| 74 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 76 |
-
CMD curl -f http://localhost:
|
| 77 |
|
| 78 |
-
# Run the FastAPI server
|
| 79 |
# The module path is constructed to work with the /app/env structure
|
| 80 |
-
CMD ["sh", "-c", "cd /app/env && uvicorn environment.app:app --host 0.0.0.0 --port
|
|
|
|
| 71 |
# Set PYTHONPATH so imports work correctly
|
| 72 |
ENV PYTHONPATH="/app/env:$PYTHONPATH"
|
| 73 |
|
| 74 |
+
# Run the FastAPI server
|
| 75 |
+
# HF Spaces exposes port 7860; set to 8000 for local dev
|
| 76 |
+
ENV PORT=${PORT:-7860}
|
| 77 |
+
|
| 78 |
+
# Health check (must be after PORT is set)
|
| 79 |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
| 80 |
+
CMD curl -f http://localhost:${PORT}/health || exit 1
|
| 81 |
|
|
|
|
| 82 |
# The module path is constructed to work with the /app/env structure
|
| 83 |
+
CMD ["sh", "-c", "cd /app/env && uvicorn environment.app:app --host 0.0.0.0 --port ${PORT}"]
|