From 4cb5bff2d96143d9e924e0704460090cde58a455 Mon Sep 17 00:00:00 2001 From: Rixuan Shao <2023311022@bipt.edu.cn> Date: Sat, 30 May 2026 00:50:58 +0800 Subject: [PATCH] Use configurable Playwright base image mirror --- .env.example | 5 +++++ DouYinSparkFlow/Dockerfile.server | 3 ++- README.md | 6 ++++++ deploy/install-server.sh | 2 +- docker-compose.yml | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index f67f7a5..94452f5 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,11 @@ PROXY_CONTROLLER_PORT=9090 PROXY_SUB_URL= PROXY_USER_AGENT=clash-verge/1.7.7 +# The Playwright base image is large. The default mirror is faster on mainland China servers. +# If the mirror is unavailable, change it back to: +# PLAYWRIGHT_BASE_IMAGE=mcr.microsoft.com/playwright/python:v1.56.0-jammy +PLAYWRIGHT_BASE_IMAGE=swr.cn-north-4.myhuaweicloud.com/ddn-k8s/mcr.microsoft.com/playwright/python:v1.56.0-jammy + # Optional build-time proxy. Leave empty unless your Docker build needs a proxy. HTTP_PROXY_BUILD= HTTPS_PROXY_BUILD= diff --git a/DouYinSparkFlow/Dockerfile.server b/DouYinSparkFlow/Dockerfile.server index a4d8eaa..8554fae 100644 --- a/DouYinSparkFlow/Dockerfile.server +++ b/DouYinSparkFlow/Dockerfile.server @@ -1,4 +1,5 @@ -FROM mcr.microsoft.com/playwright/python:v1.56.0-jammy +ARG PLAYWRIGHT_BASE_IMAGE=mcr.microsoft.com/playwright/python:v1.56.0-jammy +FROM ${PLAYWRIGHT_BASE_IMAGE} WORKDIR /app diff --git a/README.md b/README.md index a4df03e..f10c3da 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,12 @@ docker compose restart proxy 如果 `.env` 里的 `PROXY_SUB_URL` 为空,系统会使用 `proxy/config.example.yaml` 生成一个直连配置。 +首次构建会拉取较大的 Playwright 基础镜像。默认 `.env.example` 使用国内同步源以加速下载;如果同步源不可用,可以把 `.env` 里的 `PLAYWRIGHT_BASE_IMAGE` 改回: + +```bash +PLAYWRIGHT_BASE_IMAGE=mcr.microsoft.com/playwright/python:v1.56.0-jammy +``` + ## 目录结构 - `DouYinSparkFlow/`:核心应用、Web UI、登录桌面和发送任务。 diff --git a/deploy/install-server.sh b/deploy/install-server.sh index bb442d4..5965880 100755 --- a/deploy/install-server.sh +++ b/deploy/install-server.sh @@ -94,7 +94,7 @@ prepare_runtime_files() { run_root cp "$APP_ROOT/.env.example" "$APP_ROOT/.env" fi set_env_value "$APP_ROOT/.env" "APP_ROOT" "$APP_ROOT" - for key in TZ WEB_PORT LOGIN_DESKTOP_WEB_PORT PROXY_HTTP_PORT PROXY_CONTROLLER_PORT PROXY_SUB_URL HTTP_PROXY_BUILD HTTPS_PROXY_BUILD ALL_PROXY_BUILD; do + for key in TZ WEB_PORT LOGIN_DESKTOP_WEB_PORT PROXY_HTTP_PORT PROXY_CONTROLLER_PORT PROXY_SUB_URL PLAYWRIGHT_BASE_IMAGE HTTP_PROXY_BUILD HTTPS_PROXY_BUILD ALL_PROXY_BUILD; do if [ -n "${!key:-}" ]; then set_env_value "$APP_ROOT/.env" "$key" "${!key}" fi diff --git a/docker-compose.yml b/docker-compose.yml index 71567c9..4e3b672 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,7 @@ services: dockerfile: Dockerfile.server network: host args: + PLAYWRIGHT_BASE_IMAGE: ${PLAYWRIGHT_BASE_IMAGE:-swr.cn-north-4.myhuaweicloud.com/ddn-k8s/mcr.microsoft.com/playwright/python:v1.56.0-jammy} HTTP_PROXY: ${HTTP_PROXY_BUILD:-} HTTPS_PROXY: ${HTTPS_PROXY_BUILD:-} ALL_PROXY: ${ALL_PROXY_BUILD:-}