Update Dockerfile
Browse files- 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 |
-
#
|
| 20 |
-
RUN python3 -c "import os;p='src/main.py';c=open(p).read()
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
# 4.
|
| 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.
|
| 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 |
|