# --- 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"]