Mohansai2004 commited on
Commit
5b9dd2f
·
verified ·
1 Parent(s): a0041d3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -6
Dockerfile CHANGED
@@ -27,19 +27,19 @@ COPY --chown=appuser:appuser README.md ./
27
  # Switch to non-root user
28
  USER appuser
29
 
30
- # Install dependencies with verbose output and error handling
31
  ENV PATH="/home/appuser/.local/bin:${PATH}"
32
  RUN pip install --no-cache-dir --upgrade pip && \
33
  pip install --no-cache-dir --verbose torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
34
  pip install --no-cache-dir -r requirements.txt && \
35
  pip install --no-cache-dir uvicorn
36
 
37
- # Expose port for uvicorn
38
  EXPOSE 7860
39
 
40
- # Healthcheck for uvicorn
41
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
42
- CMD curl --fail http://localhost:7860 || exit 1
43
 
44
- # Start the app
45
- CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]
 
27
  # Switch to non-root user
28
  USER appuser
29
 
30
+ # Install dependencies
31
  ENV PATH="/home/appuser/.local/bin:${PATH}"
32
  RUN pip install --no-cache-dir --upgrade pip && \
33
  pip install --no-cache-dir --verbose torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
34
  pip install --no-cache-dir -r requirements.txt && \
35
  pip install --no-cache-dir uvicorn
36
 
37
+ # Expose default dev port
38
  EXPOSE 7860
39
 
40
+ # Healthcheck
41
  HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
42
+ CMD curl --fail http://localhost:${PORT:-7860} || exit 1
43
 
44
+ # Start app (use HF-provided PORT if set)
45
+ CMD uvicorn app.app:app --host 0.0.0.0 --port ${PORT:-7860}