Spaces:
Sleeping
Sleeping
File size: 1,378 Bytes
209ebac c2a5c17 209ebac c2a5c17 209ebac c2a5c17 209ebac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# --- Base on a Playwright-supported OS ---
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
# Put PW browsers in a shared, non-root path
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
# System deps + fonts Playwright/Chromium need
RUN apt-get update && apt-get install -y \
python3 python3-pip python3-venv \
curl wget unzip ca-certificates gnupg \
# GUI/codec libs that Chromium needs even when headless
libglib2.0-0 libnss3 libnspr4 libx11-xcb1 libxcomposite1 libxdamage1 libxfixes3 \
libxrandr2 libxshmfence1 libxext6 libxss1 libgbm1 \
libgtk-3-0 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libpango-1.0-0 libcups2 \
fonts-liberation fonts-ubuntu fonts-noto-color-emoji fonts-unifont \
xdg-utils lsb-release && \
rm -rf /var/lib/apt/lists/*
# Ensure the shared browser path exists and is readable
RUN mkdir -p /ms-playwright && chmod -R 0755 /ms-playwright
WORKDIR /app
# Python deps
COPY requirements.txt .
RUN python3 -m pip install -r requirements.txt
# Install ONLY Chromium (+ verify deps) into /ms-playwright
RUN python3 -m playwright install --with-deps chromium
# Copy app
COPY . .
EXPOSE 7860
CMD ["python3", "app.py"]
|