Trisha Tomy commited on
Commit
5c098bd
·
1 Parent(s): 6454f76

updated dockerfile playwright install

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -10
Dockerfile CHANGED
@@ -5,6 +5,7 @@ FROM python:3.11-slim-buster
5
  WORKDIR /app
6
 
7
  # Install system dependencies required by Playwright, Git, and other libs
 
8
  RUN apt-get update && apt-get install -y \
9
  fonts-liberation \
10
  libappindicator3-1 \
@@ -34,7 +35,7 @@ RUN apt-get update && apt-get install -y \
34
  libasound2-dev \
35
  xvfb \
36
  git \
37
- chromium \
38
  && rm -rf /var/lib/apt/lists/*
39
 
40
  # Copy common Python dependencies first (needed for pip installs)
@@ -46,10 +47,6 @@ COPY requirements.txt .
46
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
47
 
48
  # Install proxy-lite in "editable" mode directly from its GitHub repository.
49
- # The 'rm -rf /app/src/proxy-lite' is NOT needed here.
50
- # pip -e will clone into /app/src/proxy-lite by itself.
51
- # If it complains about it already existing from a *previous* build,
52
- # --force-reinstall will handle it by recreating/overwriting.
53
  RUN pip install --no-cache-dir --no-input --force-reinstall -e git+https://github.com/convergence-ai/proxy-lite.git#egg=proxy-lite
54
 
55
  # Install the rest of the common Python dependencies from requirements.txt
@@ -58,20 +55,19 @@ RUN pip install --no-cache-dir -r requirements.txt
58
  # --- END: Core Python and proxy-lite setup ---
59
 
60
  # Copy your Flask application code (app.py) and other project files.
61
- # This should happen AFTER all dependencies are installed.
62
  COPY . .
63
 
64
  # --- START: Directory permission workaround ---
65
  # Create the directory proxy-lite's recorder insists on writing to
66
  # and grant full permissions. This addresses the PermissionError.
67
- # This directory is relative to where proxy-lite is installed inside the container.
68
- # It should be safe to create it here as proxy-lite is already installed.
69
  RUN mkdir -p /app/src/proxy-lite/local_trajectories \
70
  && chmod -R 777 /app/src/proxy-lite/local_trajectories
71
  # --- END: Directory permission workaround ---
72
 
73
  # Install Playwright browser binaries within the container
74
- RUN playwright install chromium
 
 
75
 
76
  # Set environment variables for Playwright
77
  ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
@@ -82,4 +78,4 @@ ENV XDG_RUNTIME_DIR=/tmp
82
  EXPOSE 7860
83
 
84
  # Define the command to run your Flask application using Gunicorn for production.
85
- CMD exec gunicorn --bind 0.0.0.0:7860 --workers 2 --worker-class gevent app:app --timeout 300
 
5
  WORKDIR /app
6
 
7
  # Install system dependencies required by Playwright, Git, and other libs
8
+ # Removed 'chromium' from this list as Playwright will install its own
9
  RUN apt-get update && apt-get install -y \
10
  fonts-liberation \
11
  libappindicator3-1 \
 
35
  libasound2-dev \
36
  xvfb \
37
  git \
38
+ # chromium REMOVED from here
39
  && rm -rf /var/lib/apt/lists/*
40
 
41
  # Copy common Python dependencies first (needed for pip installs)
 
47
  RUN pip install --no-cache-dir --upgrade pip setuptools wheel
48
 
49
  # Install proxy-lite in "editable" mode directly from its GitHub repository.
 
 
 
 
50
  RUN pip install --no-cache-dir --no-input --force-reinstall -e git+https://github.com/convergence-ai/proxy-lite.git#egg=proxy-lite
51
 
52
  # Install the rest of the common Python dependencies from requirements.txt
 
55
  # --- END: Core Python and proxy-lite setup ---
56
 
57
  # Copy your Flask application code (app.py) and other project files.
 
58
  COPY . .
59
 
60
  # --- START: Directory permission workaround ---
61
  # Create the directory proxy-lite's recorder insists on writing to
62
  # and grant full permissions. This addresses the PermissionError.
 
 
63
  RUN mkdir -p /app/src/proxy-lite/local_trajectories \
64
  && chmod -R 777 /app/src/proxy-lite/local_trajectories
65
  # --- END: Directory permission workaround ---
66
 
67
  # Install Playwright browser binaries within the container
68
+ # Using 'python -m playwright install' is more explicit and robust
69
+ # '--with-deps' ensures all necessary system dependencies for Playwright's browser are also installed
70
+ RUN python -m playwright install chromium --with-deps
71
 
72
  # Set environment variables for Playwright
73
  ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
 
78
  EXPOSE 7860
79
 
80
  # Define the command to run your Flask application using Gunicorn for production.
81
+ CMD exec gunicorn --bind 0.0.0.0:7860 --workers 2 --worker-class gevent app:app --timeout 300