Spaces:
Sleeping
Sleeping
Commit ·
d9d16ee
1
Parent(s): c56d6fc
dockerfile changed
Browse files- Dockerfile +14 -3
Dockerfile
CHANGED
|
@@ -2,8 +2,10 @@ FROM python:3.12
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
| 7 |
libnss3 \
|
| 8 |
libnspr4 \
|
| 9 |
libdbus-1-3 \
|
|
@@ -36,8 +38,17 @@ RUN poetry install --no-root
|
|
| 36 |
# Copy the rest of the application files
|
| 37 |
COPY . .
|
| 38 |
|
| 39 |
-
# Install Playwright
|
| 40 |
-
RUN poetry run
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Expose correct port
|
| 43 |
EXPOSE 7860
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
wget \
|
| 8 |
+
gnupg \
|
| 9 |
libnss3 \
|
| 10 |
libnspr4 \
|
| 11 |
libdbus-1-3 \
|
|
|
|
| 38 |
# Copy the rest of the application files
|
| 39 |
COPY . .
|
| 40 |
|
| 41 |
+
# Install Playwright properly with explicit version
|
| 42 |
+
RUN poetry run pip install playwright==1.42.0
|
| 43 |
+
RUN poetry run playwright install --with-deps chromium
|
| 44 |
+
RUN poetry run playwright install-deps chromium
|
| 45 |
+
|
| 46 |
+
# Verify installation and create a simple test script
|
| 47 |
+
RUN echo "from playwright.sync_api import sync_playwright; print('Checking browser installation...'); with sync_playwright() as p: browser = p.chromium.launch(); browser.close(); print('Browser launched successfully!')" > test_browser.py
|
| 48 |
+
RUN poetry run python test_browser.py
|
| 49 |
+
|
| 50 |
+
# Set environment variable to use system Python for Playwright
|
| 51 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
|
| 52 |
|
| 53 |
# Expose correct port
|
| 54 |
EXPOSE 7860
|