Spaces:
Sleeping
Sleeping
sachin1801 commited on
Commit ·
c69ba47
1
Parent(s): abaf90f
Update ports for Hugging Face Spaces compatibility (7860)
Browse files- Dockerfile +8 -8
- docker-compose.yml +2 -2
Dockerfile
CHANGED
|
@@ -53,16 +53,16 @@ COPY figures/ ./figures/
|
|
| 53 |
COPY output/ ./output/
|
| 54 |
COPY data/ ./data/
|
| 55 |
|
| 56 |
-
# Create non-root user
|
| 57 |
-
RUN useradd -m -u 1000
|
| 58 |
-
USER
|
| 59 |
|
| 60 |
-
# Expose port
|
| 61 |
-
EXPOSE
|
| 62 |
|
| 63 |
# Health check
|
| 64 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 65 |
-
CMD python -c "import httpx; httpx.get('http://localhost:
|
| 66 |
|
| 67 |
-
# Run with Uvicorn
|
| 68 |
-
CMD ["python", "-m", "uvicorn", "webapp.app.main:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 53 |
COPY output/ ./output/
|
| 54 |
COPY data/ ./data/
|
| 55 |
|
| 56 |
+
# Create non-root user (HF Spaces requires user with uid 1000)
|
| 57 |
+
RUN useradd -m -u 1000 user && chown -R user:user /app
|
| 58 |
+
USER user
|
| 59 |
|
| 60 |
+
# Expose port (HF Spaces requires 7860)
|
| 61 |
+
EXPOSE 7860
|
| 62 |
|
| 63 |
# Health check
|
| 64 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| 65 |
+
CMD python -c "import httpx; httpx.get('http://localhost:7860/api/health')" || exit 1
|
| 66 |
|
| 67 |
+
# Run with Uvicorn on port 7860 for HF Spaces
|
| 68 |
+
CMD ["python", "-m", "uvicorn", "webapp.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
docker-compose.yml
CHANGED
|
@@ -4,13 +4,13 @@ services:
|
|
| 4 |
context: .
|
| 5 |
dockerfile: Dockerfile
|
| 6 |
ports:
|
| 7 |
-
- "8000:
|
| 8 |
volumes:
|
| 9 |
- ./webapp:/app/webapp # Code mount for development
|
| 10 |
environment:
|
| 11 |
- DEBUG=true
|
| 12 |
healthcheck:
|
| 13 |
-
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:
|
| 14 |
interval: 30s
|
| 15 |
timeout: 10s
|
| 16 |
retries: 3
|
|
|
|
| 4 |
context: .
|
| 5 |
dockerfile: Dockerfile
|
| 6 |
ports:
|
| 7 |
+
- "8000:7860" # Map container port 7860 to localhost:8000
|
| 8 |
volumes:
|
| 9 |
- ./webapp:/app/webapp # Code mount for development
|
| 10 |
environment:
|
| 11 |
- DEBUG=true
|
| 12 |
healthcheck:
|
| 13 |
+
test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:7860/api/health')"]
|
| 14 |
interval: 30s
|
| 15 |
timeout: 10s
|
| 16 |
retries: 3
|