Trisha Tomy commited on
Commit
dd00fd0
·
1 Parent(s): ffa6b34

updated dockerfile official image try

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -50
Dockerfile CHANGED
@@ -1,46 +1,15 @@
1
- # Use a more recent Debian version officially supported by Playwright
2
- FROM python:3.11-slim-bookworm
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install system dependencies required by Playwright, Git, and other libs
8
- # This list is more aligned with Debian Bookworm's requirements for Playwright Chromium
 
9
  RUN apt-get update && apt-get install -y \
10
- fonts-liberation \
11
- libappindicator3-1 \
12
- libasound2 \
13
- libatk-bridge2.0-0 \
14
- libatk1.0-0 \
15
- libatspi2.0-0 \
16
- libcairo2 \
17
- libcups2 \
18
- libdbus-1-3 \
19
- libdrm2 \
20
- libgdk-pixbuf2.0-0 \
21
- libglib2.0-0 \
22
- libgtk-3-0 \
23
- libnspr4 \
24
- libnss3 \
25
- libpangocairo-1.0-0 \
26
- libxcomposite1 \
27
- libxdamage1 \
28
- libxext6 \
29
- libxfixes3 \
30
- libxrandr2 \
31
- libxrender1 \
32
- libxss1 \
33
- libxtst6 \
34
- libgbm1 \
35
- libasound2-dev \
36
- xvfb \
37
  git \
38
- libxkbcommon0 \
39
- libfontconfig1 \
40
- libstdc++6 \
41
- libx11-6 \
42
- libxcb1 \
43
- libnss3-dev \
44
  # Clean up apt caches to reduce image size
45
  && rm -rf /var/lib/apt/lists/*
46
 
@@ -53,6 +22,7 @@ COPY requirements.txt .
53
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
54
 
55
  # Install proxy-lite in "editable" mode directly from its GitHub repository.
 
56
  RUN pip install --no-cache-dir --no-input --force-reinstall -e git+https://github.com/convergence-ai/proxy-lite.git#egg=proxy-lite
57
 
58
  # Install the rest of the Python dependencies from requirements.txt
@@ -68,25 +38,21 @@ RUN mkdir -p /app/src/proxy-lite/local_trajectories \
68
  && chmod -R 777 /app/src/proxy-lite/local_trajectories
69
  # --- END: Directory permission workaround ---
70
 
71
- # Set environment variables for Playwright BEFORE installing browsers,
72
- # and use xvfb-run to ensure a display environment for installation verification.
73
  ENV DISPLAY=:99
74
  ENV XDG_RUNTIME_DIR=/tmp
75
-
76
- # Install Playwright browser binaries within the container
77
- # Wrapping with xvfb-run helps ensure the environment is ready for browser checks during install
78
- RUN xvfb-run python -m playwright install chromium
79
-
80
- # Set environment variables for Playwright (can be redundant but good to ensure persistence)
81
  ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
82
- # Add this to ensure Playwright doesn't try to re-download at runtime
83
  ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
84
 
85
- # --- Debugging: Check Playwright version and browser installation (moved AFTER install) ---
86
- RUN echo "--- Checking Playwright Version ---"
 
 
87
  RUN python -m playwright --version
88
- RUN echo "--- Listing Playwright Browser Cache (Recursive) ---"
89
- # This will list contents of subdirectories as well
90
  RUN ls -alR /root/.cache/ms-playwright/
91
  RUN echo "-----------------------------------"
92
  # --- End Debugging ---
 
1
+ # Use an official Playwright Docker image for Python, matching your Playwright version and Debian base
2
+ FROM mcr.microsoft.com/playwright:v1.53.0-python-bookworm
3
 
4
  # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
+ # The official Playwright image comes with most necessary system dependencies,
8
+ # so we only need to add git for proxy-lite and potentially any very specific missing libs.
9
+ # Removing the extensive list as it's largely redundant with the Playwright base image.
10
  RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  git \
12
+ xvfb \
 
 
 
 
 
13
  # Clean up apt caches to reduce image size
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
22
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
23
 
24
  # Install proxy-lite in "editable" mode directly from its GitHub repository.
25
+ # The Playwright base image already has Playwright installed, so this just handles proxy-lite
26
  RUN pip install --no-cache-dir --no-input --force-reinstall -e git+https://github.com/convergence-ai/proxy-lite.git#egg=proxy-lite
27
 
28
  # Install the rest of the Python dependencies from requirements.txt
 
38
  && chmod -R 777 /app/src/proxy-lite/local_trajectories
39
  # --- END: Directory permission workaround ---
40
 
41
+ # Set environment variables required for Playwright at runtime
 
42
  ENV DISPLAY=:99
43
  ENV XDG_RUNTIME_DIR=/tmp
44
+ # This environment variable is set implicitly by the Playwright base image,
45
+ # but it's good practice to ensure it's here if ever changing base images.
 
 
 
 
46
  ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
47
+ # Ensure Playwright doesn't try to re-download browsers at runtime
48
  ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
49
 
50
+ # --- Debugging: Check Playwright version and browser installation (moved AFTER install in the original setup) ---
51
+ # With the official image, these are less critical as it's pre-configured,
52
+ # but keeping them for verification during the build.
53
+ RUN echo "--- Checking Playwright Version (from base image) ---"
54
  RUN python -m playwright --version
55
+ RUN echo "--- Listing Playwright Browser Cache (Recursive, from base image) ---"
 
56
  RUN ls -alR /root/.cache/ms-playwright/
57
  RUN echo "-----------------------------------"
58
  # --- End Debugging ---