nivakaran commited on
Commit
6e8abf9
·
verified ·
1 Parent(s): e213bbf

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -6
Dockerfile CHANGED
@@ -2,20 +2,44 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  curl \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # Copy requirements
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
 
 
 
 
14
  # Copy application code
15
  COPY . .
16
 
17
- # Expose port
18
- EXPOSE 8000
 
 
 
19
 
20
- # Run API server
21
- CMD ["python", "main.py"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies including Playwright requirements
6
  RUN apt-get update && apt-get install -y \
7
  curl \
8
+ wget \
9
+ gnupg \
10
+ libnss3 \
11
+ libnspr4 \
12
+ libatk1.0-0 \
13
+ libatk-bridge2.0-0 \
14
+ libcups2 \
15
+ libdrm2 \
16
+ libxkbcommon0 \
17
+ libxcomposite1 \
18
+ libxdamage1 \
19
+ libxfixes3 \
20
+ libxrandr2 \
21
+ libgbm1 \
22
+ libasound2 \
23
+ libpango-1.0-0 \
24
+ libcairo2 \
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
+ # Copy requirements and install Python dependencies
28
  COPY requirements.txt .
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # Install Playwright and browsers
32
+ RUN pip install playwright && \
33
+ playwright install chromium --with-deps
34
+
35
  # Copy application code
36
  COPY . .
37
 
38
+ # Expose port (HuggingFace Spaces expects 7860)
39
+ EXPOSE 7860
40
+
41
+ # Set environment variable for HuggingFace
42
+ ENV PORT=7860
43
 
44
+ # Run API server on port 7860 for HuggingFace Spaces
45
+ CMD ["python", "-c", "import uvicorn; uvicorn.run('main:app', host='0.0.0.0', port=7860)"]