| FROM python:3.13-slim-bookworm AS builder |
|
|
| RUN apt-get update \ |
| && apt-get install -y --no-install-recommends equivs \ |
| && equivs-control libgl1-mesa-dri \ |
| && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: libgl1-mesa-dri\nVersion: 99.0.0\nDescription: Dummy\n' >> libgl1-mesa-dri \ |
| && equivs-build libgl1-mesa-dri && mv libgl1-mesa-dri_*.deb /libgl1-mesa-dri.deb \ |
| && equivs-control adwaita-icon-theme \ |
| && printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: adwaita-icon-theme\nVersion: 99.0.0\nDescription: Dummy\n' >> adwaita-icon-theme \ |
| && equivs-build adwaita-icon-theme && mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb |
|
|
| FROM python:3.13-slim-bookworm AS chrome-downloader |
|
|
| ARG CHROME_VERSION=136.0.7103.113 |
| RUN apt-get update && apt-get install -y --no-install-recommends curl unzip \ |
| && curl -Lo /tmp/chrome.zip \ |
| "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip" \ |
| && curl -Lo /tmp/chromedriver.zip \ |
| "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip" \ |
| && unzip /tmp/chrome.zip -d /opt/ \ |
| && unzip /tmp/chromedriver.zip -d /opt/ \ |
| && chmod -R a+rx /opt/chrome-linux64 \ |
| && chmod a+rx /opt/chromedriver-linux64/chromedriver |
|
|
| FROM python:3.13-slim-bookworm |
|
|
| COPY --from=builder /*.deb / |
| COPY --from=chrome-downloader /opt/chrome-linux64 /opt/chrome |
| COPY --from=chrome-downloader /opt/chromedriver-linux64/chromedriver /usr/bin/chromedriver |
|
|
| |
| |
| RUN dpkg -i /libgl1-mesa-dri.deb && dpkg -i /adwaita-icon-theme.deb \ |
| && apt-get update \ |
| && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ |
| libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \ |
| libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 \ |
| libgbm1 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 \ |
| libwayland-client0 libglib2.0-0 libdbus-1-3 \ |
| libx11-6 libxcb1 libxext6 libfontconfig1 libfreetype6 libexpat1 \ |
| fonts-liberation fonts-liberation2 fonts-noto-color-emoji \ |
| fonts-dejavu-core fonts-freefont-ttf \ |
| dbus dbus-x11 \ |
| tzdata \ |
| locales \ |
| xvfb dumb-init git procps curl xauth \ |
| && rm -rf /var/lib/apt/lists/* \ |
| |
| && sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ |
| && locale-gen \ |
| && chmod a+rx /opt/chrome/chrome /usr/bin/chromedriver |
|
|
| |
| RUN printf '#!/bin/bash\n\ |
| exec /opt/chrome/chrome \\\n\ |
| --no-sandbox \\\n\ |
| --disable-dev-shm-usage \\\n\ |
| --disable-blink-features=AutomationControlled \\\n\ |
| --exclude-switches=enable-automation \\\n\ |
| --disable-infobars \\\n\ |
| --use-fake-ui-for-media-stream \\\n\ |
| --window-size=1920,1080 \\\n\ |
| --start-maximized \\\n\ |
| --webrtc-ip-handling-policy=disable_non_proxied_udp \\\n\ |
| "$@"\n' > /usr/local/bin/google-chrome \ |
| && chmod a+rx /usr/local/bin/google-chrome \ |
| && google-chrome --version |
|
|
| |
| RUN printf '#!/bin/bash\n\ |
| export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address 2>/dev/null)\n\ |
| exec "$@"\n' > /usr/local/bin/entrypoint.sh \ |
| && chmod +x /usr/local/bin/entrypoint.sh |
|
|
| RUN useradd -m -u 1000 user |
|
|
| WORKDIR /app |
|
|
| RUN git clone --depth=1 https://github.com/FlareSolverr/FlareSolverr.git /tmp/fs \ |
| && cp /tmp/fs/requirements.txt . |
|
|
| RUN pip install "undetected-chromedriver==3.5.5" --no-cache-dir \ |
| && pip install -r requirements.txt --no-cache-dir \ |
| && rm -rf /root/.cache |
|
|
| RUN cp -r /tmp/fs/. . && rm -rf /tmp/fs \ |
| && chown -R user:user /app |
|
|
| USER user |
| RUN mkdir -p "/home/user/.config/chromium/Crash Reports/pending" |
|
|
| |
| ENV PORT=7860 \ |
| HEADLESS=false \ |
| DISPLAY=:99 \ |
| BROWSER_EXECUTABLE_PATH=/usr/local/bin/google-chrome \ |
| BROWSER_TIMEOUT=60000 \ |
| LOG_LEVEL=info \ |
| TZ=America/New_York \ |
| LANG=en_US.UTF-8 \ |
| LC_ALL=en_US.UTF-8 \ |
| LANGUAGE=en_US:en \ |
| DEBIAN_FRONTEND=noninteractive |
|
|
| EXPOSE 7860 |
|
|
| ENTRYPOINT ["dumb-init", "xvfb-run", "-a", "-s", "-screen 0 1920x1080x24 -ac", \ |
| "/usr/local/bin/entrypoint.sh"] |
| CMD ["python", "-u", "src/flaresolverr.py"] |