Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +23 -14
Dockerfile
CHANGED
|
@@ -11,7 +11,6 @@ RUN apt-get update \
|
|
| 11 |
&& equivs-build adwaita-icon-theme \
|
| 12 |
&& mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb
|
| 13 |
|
| 14 |
-
# ── 下载 Chrome for Testing 136.0.7103.113 ──
|
| 15 |
FROM python:3.13-slim-bookworm AS chrome-downloader
|
| 16 |
|
| 17 |
ARG CHROME_VERSION=136.0.7103.113
|
|
@@ -25,7 +24,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl unzip \
|
|
| 25 |
&& chmod -R a+rx /opt/chrome-linux64 \
|
| 26 |
&& chmod a+rx /opt/chromedriver-linux64/chromedriver
|
| 27 |
|
| 28 |
-
# ── 最终镜像 ──
|
| 29 |
FROM python:3.13-slim-bookworm
|
| 30 |
|
| 31 |
COPY --from=builder /*.deb /
|
|
@@ -41,18 +39,21 @@ RUN dpkg -i /libgl1-mesa-dri.deb \
|
|
| 41 |
libgbm1 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 \
|
| 42 |
libwayland-client0 libglib2.0-0 libdbus-1-3 \
|
| 43 |
libx11-6 libxcb1 libxext6 libfontconfig1 libfreetype6 libexpat1 \
|
| 44 |
-
fonts-liberation \
|
| 45 |
xvfb dumb-init git procps curl xauth \
|
| 46 |
&& rm -rf /var/lib/apt/lists/* \
|
| 47 |
&& chmod a+rx /opt/chrome/chrome /usr/bin/chromedriver
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
#
|
| 51 |
-
#
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
> /usr/local/bin/google-chrome \
|
| 54 |
&& chmod a+rx /usr/local/bin/google-chrome \
|
| 55 |
-
# 验证 wrapper 可正常输出版本号(build 阶段即拦截问题)
|
| 56 |
&& google-chrome --version
|
| 57 |
|
| 58 |
RUN useradd -m -u 1000 user
|
|
@@ -69,13 +70,21 @@ USER user
|
|
| 69 |
|
| 70 |
RUN mkdir -p "/home/user/.config/chromium/Crash Reports/pending"
|
| 71 |
|
| 72 |
-
ENV
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
#
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
EXPOSE 7860
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
CMD ["python", "-u", "src/flaresolverr.py"]
|
|
|
|
| 11 |
&& equivs-build adwaita-icon-theme \
|
| 12 |
&& mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb
|
| 13 |
|
|
|
|
| 14 |
FROM python:3.13-slim-bookworm AS chrome-downloader
|
| 15 |
|
| 16 |
ARG CHROME_VERSION=136.0.7103.113
|
|
|
|
| 24 |
&& chmod -R a+rx /opt/chrome-linux64 \
|
| 25 |
&& chmod a+rx /opt/chromedriver-linux64/chromedriver
|
| 26 |
|
|
|
|
| 27 |
FROM python:3.13-slim-bookworm
|
| 28 |
|
| 29 |
COPY --from=builder /*.deb /
|
|
|
|
| 39 |
libgbm1 libasound2 libpango-1.0-0 libcairo2 libatspi2.0-0 \
|
| 40 |
libwayland-client0 libglib2.0-0 libdbus-1-3 \
|
| 41 |
libx11-6 libxcb1 libxext6 libfontconfig1 libfreetype6 libexpat1 \
|
| 42 |
+
fonts-liberation fonts-noto-color-emoji \
|
| 43 |
xvfb dumb-init git procps curl xauth \
|
| 44 |
&& rm -rf /var/lib/apt/lists/* \
|
| 45 |
&& chmod a+rx /opt/chrome/chrome /usr/bin/chromedriver
|
| 46 |
|
| 47 |
+
# wrapper 脚本:注入所有反检测 flags
|
| 48 |
+
# --no-sandbox : 非特权容器必须
|
| 49 |
+
# --disable-dev-shm-usage : 防止 /dev/shm 内存不足崩溃
|
| 50 |
+
# --disable-blink-features=AutomationControlled : 关键!隐藏 navigator.webdriver
|
| 51 |
+
# --window-size=1920,1080 : 模拟真实分辨率
|
| 52 |
+
# --lang=zh-CN : 模拟中文用户
|
| 53 |
+
# --disable-extensions-except / --disable-default-apps : 减少指纹
|
| 54 |
+
RUN printf '#!/bin/bash\nexec /opt/chrome/chrome \\\n --no-sandbox \\\n --disable-dev-shm-usage \\\n --disable-gpu \\\n --disable-blink-features=AutomationControlled \\\n --window-size=1920,1080 \\\n --lang=zh-CN \\\n --disable-extensions \\\n --disable-default-apps \\\n --no-first-run \\\n --disable-background-networking \\\n --disable-sync \\\n "$@"\n' \
|
| 55 |
> /usr/local/bin/google-chrome \
|
| 56 |
&& chmod a+rx /usr/local/bin/google-chrome \
|
|
|
|
| 57 |
&& google-chrome --version
|
| 58 |
|
| 59 |
RUN useradd -m -u 1000 user
|
|
|
|
| 70 |
|
| 71 |
RUN mkdir -p "/home/user/.config/chromium/Crash Reports/pending"
|
| 72 |
|
| 73 |
+
ENV PORT=7860 \
|
| 74 |
+
LOG_LEVEL=info \
|
| 75 |
+
LOG_HTML=false \
|
| 76 |
+
# ★ 关键改动:false = 不传 --headless 给 Chrome,用 xvfb 虚拟显示代替
|
| 77 |
+
# Cloudflare 能检测 --headless 模式,xvfb 对它来说是"真实"的有头浏览器
|
| 78 |
+
HEADLESS=false \
|
| 79 |
+
CAPTCHA_SOLVER=none \
|
| 80 |
+
BROWSER_EXECUTABLE_PATH=/usr/local/bin/google-chrome \
|
| 81 |
+
# xvfb 屏幕参数:1920x1080 24bit 色深
|
| 82 |
+
DISPLAY=:99
|
| 83 |
|
| 84 |
EXPOSE 7860
|
| 85 |
|
| 86 |
+
# xvfb-run 参数:
|
| 87 |
+
# -s "-screen 0 1920x1080x24" 模拟真实显示器分辨率
|
| 88 |
+
# -a 自动选择可用的 display number
|
| 89 |
+
ENTRYPOINT ["dumb-init", "xvfb-run", "-a", "-s", "-screen 0 1920x1080x24"]
|
| 90 |
CMD ["python", "-u", "src/flaresolverr.py"]
|