Spaces:
Running
Running
Trisha Tomy
commited on
Commit
·
6da58ba
1
Parent(s):
c26a5ea
updated dockerfile added debug stmts+debian update
Browse files- Dockerfile +22 -15
Dockerfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.11-slim-
|
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 |
-
#
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
fonts-liberation \
|
11 |
libappindicator3-1 \
|
@@ -31,17 +31,17 @@ RUN apt-get update && apt-get install -y \
|
|
31 |
libxrender1 \
|
32 |
libxss1 \
|
33 |
libxtst6 \
|
34 |
-
|
35 |
libasound2-dev \
|
36 |
xvfb \
|
37 |
git \
|
38 |
-
# Additional Playwright dependencies for Debian Buster:
|
39 |
libxkbcommon0 \
|
40 |
libfontconfig1 \
|
41 |
libstdc++6 \
|
42 |
libx11-6 \
|
43 |
libxcb1 \
|
44 |
-
|
|
|
45 |
&& rm -rf /var/lib/apt/lists/*
|
46 |
|
47 |
# Copy common Python dependencies first (needed for pip installs)
|
@@ -55,12 +55,16 @@ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
|
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
|
59 |
RUN pip install --no-cache-dir -r requirements.txt
|
60 |
-
RUN python -m playwright --version
|
61 |
-
RUN ls -al /root/.cache/ms-playwright/ # To see if browsers are even downloaded
|
62 |
|
63 |
-
# ---
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
# Copy your Flask application code (app.py) and other project files.
|
66 |
COPY . .
|
@@ -72,14 +76,17 @@ RUN mkdir -p /app/src/proxy-lite/local_trajectories \
|
|
72 |
&& chmod -R 777 /app/src/proxy-lite/local_trajectories
|
73 |
# --- END: Directory permission workaround ---
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
# Install Playwright browser binaries within the container
|
76 |
-
#
|
77 |
-
RUN python -m playwright install chromium
|
78 |
|
79 |
-
# Set environment variables for Playwright
|
80 |
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
|
81 |
-
ENV DISPLAY=:99
|
82 |
-
ENV XDG_RUNTIME_DIR=/tmp
|
83 |
|
84 |
# Expose the port your Flask app will listen on. Hugging Face Spaces requires 7860.
|
85 |
EXPOSE 7860
|
|
|
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 \
|
|
|
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 |
|
47 |
# Copy common Python dependencies first (needed for pip installs)
|
|
|
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
|
59 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
60 |
|
61 |
+
# --- Debugging: Check Playwright version and browser installation ---
|
62 |
+
RUN echo "--- Checking Playwright Version ---"
|
63 |
+
RUN python -m playwright --version
|
64 |
+
RUN echo "--- Listing Playwright Browser Cache ---"
|
65 |
+
RUN ls -al /root/.cache/ms-playwright/
|
66 |
+
RUN echo "-----------------------------------"
|
67 |
+
# --- End Debugging ---
|
68 |
|
69 |
# Copy your Flask application code (app.py) and other project files.
|
70 |
COPY . .
|
|
|
76 |
&& chmod -R 777 /app/src/proxy-lite/local_trajectories
|
77 |
# --- END: Directory permission workaround ---
|
78 |
|
79 |
+
# Set environment variables for Playwright BEFORE installing browsers,
|
80 |
+
# and use xvfb-run to ensure a display environment for installation verification.
|
81 |
+
ENV DISPLAY=:99
|
82 |
+
ENV XDG_RUNTIME_DIR=/tmp
|
83 |
+
|
84 |
# Install Playwright browser binaries within the container
|
85 |
+
# Wrapping with xvfb-run helps ensure the environment is ready for browser checks during install
|
86 |
+
RUN xvfb-run python -m playwright install chromium
|
87 |
|
88 |
+
# Set environment variables for Playwright (can be redundant but good to ensure persistence)
|
89 |
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright/
|
|
|
|
|
90 |
|
91 |
# Expose the port your Flask app will listen on. Hugging Face Spaces requires 7860.
|
92 |
EXPOSE 7860
|