fix: provision Node runtime in server image

This commit is contained in:
Rixuan Shao
2026-07-11 15:42:34 +08:00
parent e3142cabbf
commit 32d58940ff
7 changed files with 28 additions and 1 deletions
+1
View File
@@ -26,6 +26,7 @@ PROXY_USER_AGENT=clash-verge/1.7.7
# 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
NODE_RUNTIME_IMAGE=node:22-bookworm-slim
# Optional build-time proxy. Leave empty unless your Docker build needs a proxy.
HTTP_PROXY_BUILD=
+2
View File
@@ -2,6 +2,8 @@
## 2026-07-11
- Fixed the server image to provision Node.js 22 explicitly for protocol mode and excluded runtime logs/configuration from the Docker build context.
- Reworked the Web console into a responsive unified operations dashboard with local Lucide icons, clearer account/target status, and safer confirmation dialogs.
- Added strong send-confirmation state handling, retryable unconfirmed targets, failure categorization, account cooldowns, and focused manual retry modes.
- Improved friend-list discovery, persistent browser profiles, Cookie synchronization, and browser/protocol failure persistence.
+12
View File
@@ -0,0 +1,12 @@
__pycache__/
*.py[cod]
.pytest_cache/
.ruff_cache/
.git/
.github/
tests/
logs/
config.json
usersData.json
webui_settings.json
*.log
+4
View File
@@ -1,6 +1,10 @@
ARG PLAYWRIGHT_BASE_IMAGE=mcr.microsoft.com/playwright/python:v1.56.0-jammy
ARG NODE_RUNTIME_IMAGE=node:22-bookworm-slim
FROM ${NODE_RUNTIME_IMAGE} AS node-runtime
FROM ${PLAYWRIGHT_BASE_IMAGE}
COPY --from=node-runtime /usr/local/bin/node /usr/local/bin/node
WORKDIR /app
ARG HTTP_PROXY
@@ -88,11 +88,18 @@ class DeploymentContractTests(unittest.TestCase):
def test_playwright_base_image_argument_is_used(self):
dockerfile = (SOURCE_ROOT / "Dockerfile.server").read_text(encoding="utf-8")
self.assertTrue(dockerfile.startswith("ARG PLAYWRIGHT_BASE_IMAGE="))
self.assertIn("FROM ${NODE_RUNTIME_IMAGE} AS node-runtime", dockerfile)
self.assertIn("FROM ${PLAYWRIGHT_BASE_IMAGE}", dockerfile)
self.assertIn("COPY --from=node-runtime /usr/local/bin/node", dockerfile)
self.assertIn("docker.io", dockerfile)
self.assertIn("node --version", dockerfile)
self.assertNotIn("github.com/docker/compose", dockerfile)
def test_docker_build_context_excludes_runtime_data(self):
dockerignore = (SOURCE_ROOT / ".dockerignore").read_text(encoding="utf-8")
for entry in ("logs/", "config.json", "usersData.json", "webui_settings.json"):
self.assertIn(entry, dockerignore)
def test_legacy_unused_entrypoints_are_removed(self):
self.assertFalse((SOURCE_ROOT / "webui" / "login_sessions.py").exists())
self.assertFalse((SOURCE_ROOT / "relogin_worker.py").exists())
+1 -1
View File
@@ -156,7 +156,7 @@ prepare_runtime_files() {
set_env_value "$env_file" "APP_ROOT" "$APP_ROOT"
set_env_value "$env_file" "DEFAULT_SCHEDULE" "$DEFAULT_SCHEDULE"
for key in TZ WEB_BIND_ADDRESS WEB_PORT SPARKFLOW_SESSION_COOKIE_SECURE LOGIN_DESKTOP_BIND_ADDRESS LOGIN_DESKTOP_WEB_PORT LOGIN_DESKTOP_PUBLIC_URL PROXY_BIND_ADDRESS PROXY_HTTP_PORT PROXY_CONTROLLER_PORT PROXY_SUB_URL PROXY_USER_AGENT PLAYWRIGHT_BASE_IMAGE HTTP_PROXY_BUILD HTTPS_PROXY_BUILD ALL_PROXY_BUILD PIP_INDEX_URL PIP_TRUSTED_HOST; do
for key in TZ WEB_BIND_ADDRESS WEB_PORT SPARKFLOW_SESSION_COOKIE_SECURE LOGIN_DESKTOP_BIND_ADDRESS LOGIN_DESKTOP_WEB_PORT LOGIN_DESKTOP_PUBLIC_URL PROXY_BIND_ADDRESS PROXY_HTTP_PORT PROXY_CONTROLLER_PORT PROXY_SUB_URL PROXY_USER_AGENT PLAYWRIGHT_BASE_IMAGE NODE_RUNTIME_IMAGE HTTP_PROXY_BUILD HTTPS_PROXY_BUILD ALL_PROXY_BUILD PIP_INDEX_URL PIP_TRUSTED_HOST; do
if [ -n "${!key:-}" ]; then
set_env_value "$env_file" "$key" "${!key}"
fi
+1
View File
@@ -21,6 +21,7 @@ services:
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}
NODE_RUNTIME_IMAGE: ${NODE_RUNTIME_IMAGE:-node:22-bookworm-slim}
HTTP_PROXY: ${HTTP_PROXY_BUILD:-}
HTTPS_PROXY: ${HTTPS_PROXY_BUILD:-}
ALL_PROXY: ${ALL_PROXY_BUILD:-}