Baskar2005 commited on
Commit
e0d8c79
·
verified ·
1 Parent(s): 5b53d68

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -24
Dockerfile CHANGED
@@ -1,24 +1,28 @@
1
- # Use the official Playwright image (includes Python & Chromium dependencies)
2
- FROM mcr.microsoft.com/playwright/python:v1.41.0-jammy
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Copy dependency file and install Python packages
8
- COPY requirements.txt .
9
- RUN pip install --no-cache-dir -r requirements.txt
10
-
11
- # Install Chromium specifically (lightweight)
12
- RUN playwright install chromium
13
-
14
- # Copy all your project files
15
- COPY . .
16
-
17
- # Grant permissions (Hugging Face sometimes runs as non-root)
18
- RUN chmod -R 777 /app
19
-
20
- # Expose the port Hugging Face expects
21
- EXPOSE 7860
22
-
23
- # Run the application
24
- CMD ["python", "app.py"]
 
 
 
 
 
1
+ # Use the official Playwright image
2
+ FROM mcr.microsoft.com/playwright/python:v1.41.0-jammy
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # 1. Install Xvfb (The Virtual Monitor) and other dependencies
8
+ RUN apt-get update && apt-get install -y xvfb libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0
9
+
10
+ # Copy requirements and install
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ # Install Chromium
15
+ RUN playwright install chromium
16
+
17
+ # Copy all project files
18
+ COPY . .
19
+
20
+ # Grant permissions
21
+ RUN chmod -R 777 /app
22
+
23
+ # Expose the port
24
+ EXPOSE 7860
25
+
26
+ # 2. START COMMAND (Run Python inside the Virtual Monitor)
27
+ # We use "xvfb-run" to create a fake screen before launching the app
28
+ CMD ["xvfb-run", "--auto-servernum", "--server-args='-screen 0 1280x1024x24'", "python", "app.py"]