dina1 commited on
Commit
4e6dfd4
·
verified ·
1 Parent(s): 58a8788

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -5
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # ===============================
2
- # 🐳 Dockerfile for Hugging Face Spaces - FastAPI + Gemini
3
  # ===============================
4
 
5
  # 1️⃣ Use a lightweight Python base image
@@ -8,15 +8,41 @@ FROM python:3.10-slim
8
  # 2️⃣ Set working directory
9
  WORKDIR /app
10
 
11
- # 3️⃣ Copy dependency list and install dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
- # 4️⃣ Copy all project files
 
 
 
16
  COPY . .
17
 
18
- # 5️⃣ Expose the default Hugging Face port
19
  EXPOSE 7860
20
 
21
- # 6️⃣ Start FastAPI using uvicorn (Hugging Face detects port 7860)
22
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # ===============================
2
+ # 🐳 Dockerfile for Hugging Face Spaces - FastAPI + Gemini + Playwright
3
  # ===============================
4
 
5
  # 1️⃣ Use a lightweight Python base image
 
8
  # 2️⃣ Set working directory
9
  WORKDIR /app
10
 
11
+ # 3️⃣ Install system dependencies for Playwright (Chromium)
12
+ # These are required to run Chromium headless in the container.
13
+ RUN apt-get update && apt-get install -y \
14
+ chromium \
15
+ libasound2 \
16
+ libatk1.0-0 \
17
+ libatk-bridge2.0-0 \
18
+ libcairo2 \
19
+ libx11-xcb1 \
20
+ libxcomposite1 \
21
+ libxdamage1 \
22
+ libxrandr2 \
23
+ libxshmfence1 \
24
+ libxss1 \
25
+ libxtst6 \
26
+ libnss3 \
27
+ libnspr4 \
28
+ libgbm1 \
29
+ libgtk-3-0 \
30
+ xdg-utils \
31
+ fonts-liberation \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # 4️⃣ Copy and install Python dependencies
35
  COPY requirements.txt .
36
  RUN pip install --no-cache-dir -r requirements.txt
37
 
38
+ # 5️⃣ Install Playwright browsers (Chromium only)
39
+ RUN playwright install --with-deps chromium
40
+
41
+ # 6️⃣ Copy all project files
42
  COPY . .
43
 
44
+ # 7️⃣ Expose the default Hugging Face port
45
  EXPOSE 7860
46
 
47
+ # 8️⃣ Start FastAPI using Uvicorn
48
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]