Rox-Turbo commited on
Commit
b2c7c75
·
verified ·
1 Parent(s): cee0827

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -2
Dockerfile CHANGED
@@ -12,8 +12,12 @@ RUN pip install --no-cache-dir -r requirements.txt
12
  # Copy application code
13
  COPY . .
14
 
 
 
 
15
  # Hugging Face Spaces runs as user 1000
16
  RUN useradd -m -u 1000 user
 
17
  USER user
18
 
19
  # Set PATH for user
@@ -22,6 +26,10 @@ ENV PATH="/home/user/.local/bin:$PATH"
22
  # Expose port 7860 (Hugging Face Spaces default)
23
  EXPOSE 7860
24
 
25
- # Start server on port 7860 for Hugging Face Spaces
26
- CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
27
 
 
12
  # Copy application code
13
  COPY . .
14
 
15
+ # Make startup script executable
16
+ RUN chmod +x start.sh
17
+
18
  # Hugging Face Spaces runs as user 1000
19
  RUN useradd -m -u 1000 user
20
+ RUN chown -R user:user /app
21
  USER user
22
 
23
  # Set PATH for user
 
26
  # Expose port 7860 (Hugging Face Spaces default)
27
  EXPOSE 7860
28
 
29
+ # Health check
30
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
31
+ CMD python3 -c "import requests; requests.get('http://localhost:7860/health')" || exit 1
32
+
33
+ # Start server
34
+ CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
35