Onyxl commited on
Commit
7be7abf
·
verified ·
1 Parent(s): 92652e2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -25
Dockerfile CHANGED
@@ -1,37 +1,24 @@
1
- FROM python:3.11-slim
 
2
 
3
- # Install system dependencies required for Playwright browsers
4
- RUN apt-get update && apt-get install -y \
5
- wget \
6
- gnupg \
7
- libgconf-2-4 \
8
- libatk1.0-0 \
9
- libatk-bridge2.0-0 \
10
- libgdk-pixbuf2.0-0 \
11
- libgtk-3-0 \
12
- libgbm-dev \
13
- libnss3 \
14
- libasound2 \
15
- libxss1 \
16
- libxtst6 \
17
- xvfb \
18
- && rm -rf /var/lib/apt/lists/*
19
-
20
- # Set up a non-root user
21
  RUN useradd -m -u 1000 user
22
  USER user
23
- ENV HOME=/home/user
 
 
24
  WORKDIR $HOME/app
25
 
26
  # Install Python dependencies
27
- COPY --chown=user requirements.txt requirements.txt
28
  RUN pip install --no-cache-dir --user -r requirements.txt
29
 
30
- # Install Playwright and download browsers
31
- RUN playwright install --with-deps
 
32
 
33
  # Copy application code
34
  COPY --chown=user . .
35
 
36
- # Run the script using Xvfb (Virtual Framebuffer) for headless execution
37
- CMD ["xvfb-run", "-a", "python", "app.py"]
 
1
+ # Use the official Playwright image which has all system deps pre-installed
2
+ FROM ://microsoft.com
3
 
4
+ # Set up a non-root user for Hugging Face compatibility
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  RUN useradd -m -u 1000 user
6
  USER user
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
  WORKDIR $HOME/app
11
 
12
  # Install Python dependencies
13
+ COPY --chown=user requirements.txt .
14
  RUN pip install --no-cache-dir --user -r requirements.txt
15
 
16
+ # Playwright browsers are already in the image,
17
+ # but we ensure the Python links are ready
18
+ RUN python3 -m playwright install chromium
19
 
20
  # Copy application code
21
  COPY --chown=user . .
22
 
23
+ # Run with Xvfb to provide a display for the browser
24
+ CMD ["xvfb-run", "-a", "python3", "app.py"]