ABDALLALSWAITI commited on
Commit
830142a
·
verified ·
1 Parent(s): ce83640

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -9
Dockerfile CHANGED
@@ -39,10 +39,10 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
39
  # Create user (required for HF Spaces)
40
  RUN useradd -m -u 1000 user
41
 
42
- # Copy dependency files first (for better caching)
43
  COPY --chown=user requirements.txt package.json ./
44
 
45
- # Install dependencies
46
  RUN pip install --no-cache-dir -r requirements.txt
47
  RUN npm install
48
 
@@ -52,7 +52,7 @@ COPY --chown=user app.py puppeteer_pdf.js ./
52
  # Make puppeteer script executable
53
  RUN chmod +x puppeteer_pdf.js
54
 
55
- # Set permissions for temp directory
56
  RUN mkdir -p /tmp && chmod 777 /tmp
57
 
58
  # Switch to user
@@ -65,12 +65,8 @@ ENV HOME=/home/user \
65
  PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
66
  PYTHONUNBUFFERED=1
67
 
68
- # Expose port (IMPORTANT: Must be 7860 for HF Spaces)
69
  EXPOSE 7860
70
 
71
- # Health check to help HF Spaces detect when app is ready
72
- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
73
- CMD curl -f http://localhost:7860/ || exit 1
74
-
75
  # Start application
76
- CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
 
39
  # Create user (required for HF Spaces)
40
  RUN useradd -m -u 1000 user
41
 
42
+ # Copy dependency files
43
  COPY --chown=user requirements.txt package.json ./
44
 
45
+ # Install Python and Node dependencies
46
  RUN pip install --no-cache-dir -r requirements.txt
47
  RUN npm install
48
 
 
52
  # Make puppeteer script executable
53
  RUN chmod +x puppeteer_pdf.js
54
 
55
+ # Set permissions
56
  RUN mkdir -p /tmp && chmod 777 /tmp
57
 
58
  # Switch to user
 
65
  PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
66
  PYTHONUNBUFFERED=1
67
 
68
+ # Expose port
69
  EXPOSE 7860
70
 
 
 
 
 
71
  # Start application
72
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]