Download Dockerfile from eres69/cloudflare-bypass-api: direct link, hf CLI and curl.
- Browser
- Download file 3.86 kB
-
https://huggingface.co/spaces/eres69/cloudflare-bypass-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/eres69/cloudflare-bypass-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/eres69/cloudflare-bypass-api/resolve/main/Dockerfile
3.86 kB
| FROM python:3.12-slim | |
| # Prevent interactive prompts | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 | |
| # ββ SeleniumBase UC Mode ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # UC Mode REQUIRES official Google Chrome, NOT apt's "chromium". | |
| # Chromium lacks the patching hooks that make undetected-chromedriver work. | |
| # SB_SKIP_BROWSER_DOWNLOAD=1 tells SeleniumBase to NOT auto-fetch Chrome on startup | |
| # (we install it manually below via the official Google repo). | |
| ENV SB_SKIP_BROWSER_DOWNLOAD=1 | |
| # ββ Scrapling StealthyFetcher (Playwright) ββββββββββββββββββββββββββββββββββββ | |
| # PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD only suppresses the pip-install hook. | |
| # We still need 'playwright install' to run AFTER pip installs, pointing at a | |
| # writable path for the non-root user. Set here so the install step picks it up. | |
| ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \ | |
| PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright | |
| # ββ Install system deps βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| # Network / utils | |
| wget gnupg curl ca-certificates unzip tzdata \ | |
| # Virtual display (required for Chrome UC Mode on headless servers) | |
| xvfb xauth x11-utils \ | |
| # Chrome shared library dependencies | |
| libnss3 libfontconfig1 libxrender1 libxext6 libx11-6 \ | |
| libatk-bridge2.0-0 libgtk-3-0 libgbm1 libdbus-glib-1-2 \ | |
| libxrandr2 libxss1 libxi6 libxtst6 libxfixes3 libxdamage1 \ | |
| libxcomposite1 libxcursor1 fonts-liberation \ | |
| # libasound2t64 is the correct name in Debian Bookworm (python:3.12-slim) | |
| libasound2t64 \ | |
| # Python build tools (for curl_cffi compilation if no wheel available) | |
| build-essential gcc libffi-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Install official Google Chrome Stable ββββββββββββββββββββββββββββββββββββ | |
| # This is what SeleniumBase UC Mode actually patches and needs. | |
| RUN wget -q -O /tmp/google-chrome.deb \ | |
| "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" \ | |
| && apt-get update \ | |
| && apt-get install -y /tmp/google-chrome.deb \ | |
| && rm /tmp/google-chrome.deb \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ββ Non-root user (required by Hugging Face) βββββββββββββββββββββββββββββββββ | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # ββ Python dependencies βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # ββ Install Playwright browser for Scrapling StealthyFetcher βββββββββββββββββ | |
| # This runs AFTER pip install so the playwright CLI is available. | |
| # It downloads only Chromium (smallest) with all its needed system libs. | |
| RUN python -m playwright install chromium | |
| # ββ Application source ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY --chown=user . . | |
| # Hugging Face requires port 7860 | |
| EXPOSE 7860 | |
| # Start the API server on port 7860 | |
| # Stage 4 (browser) is disabled by default on HF to avoid memory issues | |
| # Enable with: ENABLE_STAGE4=true | |
| CMD ["python", "main.py"] | |