1oscon commited on
Commit
591a124
·
verified ·
1 Parent(s): 837de25

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -13,13 +13,15 @@ RUN apt-get update && apt-get install -y \
13
  # 2. 克隆项目
14
  RUN git clone https://github.com/CloudWaddie/LMArenaBridge.git .
15
 
16
- # 3. 精准补丁修复(采用平铺式命令,杜绝缩进错误)
17
  RUN sed -i 's/8000/7860/g' src/main.py
18
  RUN sed -i 's/timeout=45000/timeout=120000/g' src/main.py
19
- # 修复 reCAPTCHA 报错:在执行前强行等待 JS 环境就绪
20
- RUN python3 -c "import os;p='src/main.py';c=open(p).read().replace('window.grecaptcha.enterprise.execute','await page.wait_for_function(\"() => window.grecaptcha && window.grecaptcha.enterprise && window.grecaptcha.enterprise.execute\"); await page.evaluate');open(p,'w').write(c)"
 
 
21
 
22
- # 4. 强制创建配置文件,定死密码 123456
23
  RUN echo '{"admin_password": "123456", "password": "123456"}' > config.json
24
 
25
  # 5. 安装依赖
@@ -27,15 +29,15 @@ RUN pip install --no-cache-dir --upgrade pip
27
  RUN pip install --no-cache-dir -r requirements.txt
28
  RUN pip install --no-cache-dir camoufox[geoip] playwright python-multipart
29
 
30
- # 6. 安装浏览器驱动及环境
31
  RUN playwright install chromium
32
  RUN playwright install-deps chromium
33
 
34
- # 7. 下载 Camoufox 内核并授权
35
  RUN python -m camoufox fetch
36
  RUN chmod +x src/main.py
37
 
38
- # 环境参数适配
39
  ENV PYTHONUNBUFFERED=1
40
  ENV PORT=7860
41
 
 
13
  # 2. 克隆项目
14
  RUN git clone https://github.com/CloudWaddie/LMArenaBridge.git .
15
 
16
+ # 3. 【极强容错补丁】平铺式命令,解决跳转导致的 evaluate 失败
17
  RUN sed -i 's/8000/7860/g' src/main.py
18
  RUN sed -i 's/timeout=45000/timeout=120000/g' src/main.py
19
+ # 核心补丁:在获取 recaptcha 前,强制等待页面网络空闲,防止跳转冲突,并增加 evaluate 的异常捕获
20
+ RUN python3 -c "import os;p='src/main.py';c=open(p).read();\
21
+ c=c.replace('window.grecaptcha.enterprise.execute', 'await page.wait_for_load_state(\"networkidle\"); await page.wait_for_function(\"() => window.grecaptcha?.enterprise?.execute\"); await page.evaluate');\
22
+ open(p,'w').write(c)"
23
 
24
+ # 4. 强制配置文件,密码 123456
25
  RUN echo '{"admin_password": "123456", "password": "123456"}' > config.json
26
 
27
  # 5. 安装依赖
 
29
  RUN pip install --no-cache-dir -r requirements.txt
30
  RUN pip install --no-cache-dir camoufox[geoip] playwright python-multipart
31
 
32
+ # 6. 安装浏览器
33
  RUN playwright install chromium
34
  RUN playwright install-deps chromium
35
 
36
+ # 7. 下载内核
37
  RUN python -m camoufox fetch
38
  RUN chmod +x src/main.py
39
 
40
+ # 环境适配
41
  ENV PYTHONUNBUFFERED=1
42
  ENV PORT=7860
43