File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build and Push Beta Docker Image
2+
3+ on :
4+ push :
5+ branches :
6+ - beta
7+ workflow_dispatch :
8+
9+ env :
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build-and-push-beta :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Set up QEMU
25+ uses : docker/setup-qemu-action@v3
26+
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v3
29+
30+ - name : Log in to Container Registry
31+ uses : docker/login-action@v3
32+ with :
33+ registry : ${{ env.REGISTRY }}
34+ username : ${{ github.actor }}
35+ password : ${{ secrets.GITHUB_TOKEN }}
36+
37+ - name : Extract metadata
38+ id : meta
39+ uses : docker/metadata-action@v5
40+ with :
41+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+ tags : |
43+ type=raw,value=beta
44+
45+ - name : Build and push Docker image (beta)
46+ uses : docker/build-push-action@v5
47+ with :
48+ context : .
49+ file : Dockerfile.headed
50+ platforms : linux/amd64,linux/arm64
51+ push : true
52+ tags : ${{ steps.meta.outputs.tags }}
53+ labels : ${{ steps.meta.outputs.labels }}
54+ cache-from : type=gha,scope=beta
55+ cache-to : type=gha,mode=max,scope=beta
Original file line number Diff line number Diff line change 6262config /setting.toml
6363config /setting_warp.toml
6464config /setting_warp_example.toml
65+
66+ # 测试文件
67+ test_ *
68+ tests /__pycache__ /
69+ * .har
Original file line number Diff line number Diff line change @@ -4,24 +4,33 @@ WORKDIR /app
44
55ENV PYTHONDONTWRITEBYTECODE=1 \
66 PYTHONUNBUFFERED=1 \
7- PLAYWRIGHT_BROWSERS_PATH=0 \
8- ALLOW_DOCKER_HEADED_CAPTCHA=true \
9- DISPLAY=:99 \
10- XVFB_WHD=1920x1080x24
7+ ALLOW_DOCKER_HEADED_CAPTCHA=true
118
9+ # 安装 Chrome 运行依赖(无头模式仍需要这些系统库)
1210COPY requirements.txt ./
1311
14- # 有头模式基础依赖:虚拟显示、窗口管理器。
1512RUN apt-get update \
1613 && apt-get install -y --no-install-recommends \
1714 ca-certificates \
1815 curl \
19- xvfb \
20- fluxbox \
16+ libnss3 \
17+ libnspr4 \
18+ libatk1.0-0 \
19+ libatk-bridge2.0-0 \
20+ libcups2 \
21+ libdrm2 \
22+ libxkbcommon0 \
23+ libxcomposite1 \
24+ libxdamage1 \
25+ libxfixes3 \
26+ libxrandr2 \
27+ libgbm1 \
28+ libpango-1.0-0 \
29+ libcairo2 \
30+ libasound2 \
2131 && rm -rf /var/lib/apt/lists/*
2232
23- RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt \
24- && python -m playwright install --with-deps chromium
33+ RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
2534
2635COPY . .
2736COPY docker/entrypoint.headed.sh /usr/local/bin/entrypoint.headed.sh
Original file line number Diff line number Diff line change @@ -16,7 +16,5 @@ services:
1616 environment :
1717 - PYTHONUNBUFFERED=1
1818 - ALLOW_DOCKER_HEADED_CAPTCHA=true
19- - DISPLAY=:99
20- - XVFB_WHD=1920x1080x24
2119 shm_size : " 2gb"
2220 restart : unless-stopped
Original file line number Diff line number Diff line change 11#! /bin/sh
22set -eu
33
4- export DISPLAY=" ${DISPLAY:-: 99} "
5- export ALLOW_DOCKER_HEADED_CAPTCHA=" ${ALLOW_DOCKER_HEADED_CAPTCHA:- true} "
6- export XVFB_WHD=" ${XVFB_WHD:- 1920x1080x24} "
7-
8- echo " [entrypoint] starting Xvfb on ${DISPLAY} (${XVFB_WHD} )"
9- Xvfb " ${DISPLAY} " -screen 0 " ${XVFB_WHD} " -ac -nolisten tcp +extension RANDR > /tmp/xvfb.log 2>&1 &
10-
11- sleep 1
12-
13- echo " [entrypoint] starting Fluxbox"
14- fluxbox > /tmp/fluxbox.log 2>&1 &
15-
16- if [ -z " ${BROWSER_EXECUTABLE_PATH:- } " ]; then
17- BROWSER_EXECUTABLE_PATH=" $( python - << 'PY '
18- from playwright.sync_api import sync_playwright
19-
20- try:
21- with sync_playwright() as p:
22- print(p.chromium.executable_path)
23- except Exception:
24- print("")
25- PY
26- ) "
27- if [ -n " ${BROWSER_EXECUTABLE_PATH} " ]; then
28- export BROWSER_EXECUTABLE_PATH
29- echo " [entrypoint] browser executable: ${BROWSER_EXECUTABLE_PATH} "
30- fi
31- fi
32-
4+ echo " [entrypoint] starting flow2api (headless browser mode)"
335exec python main.py
Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ class BrowserCaptchaService:
446446
447447 def __init__ (self , db = None ):
448448 """初始化服务"""
449- self .headless = False # nodriver 有头模式
449+ self .headless = True # 无头模式
450450 self .browser = None
451451 self ._initialized = False
452452 self .website_key = "6LdsFiUsAAAAAIjVDZcuLhaHiDn5nnHVXVRQGeMV"
You can’t perform that action at this time.
0 commit comments