diff --git a/scripts/lib/live-docker-stage.sh b/scripts/lib/live-docker-stage.sh index 74bb8a71472..73ab22c66dd 100644 --- a/scripts/lib/live-docker-stage.sh +++ b/scripts/lib/live-docker-stage.sh @@ -55,7 +55,9 @@ openclaw_live_stage_source_tree() { openclaw_live_link_runtime_tree() { local dest_dir="${1:?destination directory required}" - ln -s /app/node_modules "$dest_dir/node_modules" + if [ ! -e "$dest_dir/node_modules" ]; then + ln -s /app/node_modules "$dest_dir/node_modules" + fi ln -s /app/dist "$dest_dir/dist" if [ -d /app/dist-runtime/extensions ]; then export OPENCLAW_BUNDLED_PLUGINS_DIR=/app/dist-runtime/extensions @@ -64,6 +66,16 @@ openclaw_live_link_runtime_tree() { fi } +openclaw_live_stage_node_modules() { + local dest_dir="${1:?destination directory required}" + local target_dir="$dest_dir/node_modules" + + mkdir -p "$target_dir" + find /app/node_modules -mindepth 1 -maxdepth 1 -exec ln -s {} "$target_dir" \; + rm -rf "$target_dir/.vite-temp" + mkdir -p "$target_dir/.vite-temp" +} + openclaw_live_stage_state_dir() { local dest_dir="${1:?destination directory required}" local source_dir="${HOME}/.openclaw" diff --git a/scripts/test-live-acp-bind-docker.sh b/scripts/test-live-acp-bind-docker.sh index 1152ca816b5..2d75ac6d8c7 100644 --- a/scripts/test-live-acp-bind-docker.sh +++ b/scripts/test-live-acp-bind-docker.sh @@ -163,13 +163,7 @@ esac tmp_dir="$(mktemp -d)" source /src/scripts/lib/live-docker-stage.sh openclaw_live_stage_source_tree "$tmp_dir" -# Use a writable node_modules overlay in the temp repo. Vite writes bundled -# config artifacts under the nearest node_modules/.vite-temp path, and the -# build-stage /app/node_modules tree is root-owned in this Docker lane. -mkdir -p "$tmp_dir/node_modules" -cp -aRs /app/node_modules/. "$tmp_dir/node_modules" -rm -rf "$tmp_dir/node_modules/.vite-temp" -mkdir -p "$tmp_dir/node_modules/.vite-temp" +openclaw_live_stage_node_modules "$tmp_dir" openclaw_live_link_runtime_tree "$tmp_dir" openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state" openclaw_live_prepare_staged_config @@ -285,6 +279,7 @@ for ACP_AGENT in "${ACP_AGENTS[@]}"; do -e OPENCLAW_DOCKER_AUTH_PRESTAGED="$DOCKER_AUTH_PRESTAGED" \ -e OPENCLAW_DOCKER_AUTH_DIRS_RESOLVED="$AUTH_DIRS_CSV" \ -e OPENCLAW_DOCKER_AUTH_FILES_RESOLVED="$AUTH_FILES_CSV" \ + -e OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}" \ -e OPENCLAW_LIVE_TEST=1 \ -e OPENCLAW_LIVE_ACP_BIND=1 \ -e OPENCLAW_LIVE_ACP_BIND_AGENT="$ACP_AGENT" \ diff --git a/scripts/test-live-cli-backend-docker.sh b/scripts/test-live-cli-backend-docker.sh index 030befcfc3d..ee0da8d112e 100644 --- a/scripts/test-live-cli-backend-docker.sh +++ b/scripts/test-live-cli-backend-docker.sh @@ -371,10 +371,7 @@ openclaw_live_stage_source_tree "$tmp_dir" # Use a writable node_modules overlay in the temp repo. Vite writes bundled # config artifacts under the nearest node_modules/.vite-temp path, and the # build-stage /app/node_modules tree is root-owned in this Docker lane. -mkdir -p "$tmp_dir/node_modules" -cp -aRs /app/node_modules/. "$tmp_dir/node_modules" -rm -rf "$tmp_dir/node_modules/.vite-temp" -mkdir -p "$tmp_dir/node_modules/.vite-temp" +openclaw_live_stage_node_modules "$tmp_dir" openclaw_live_link_runtime_tree "$tmp_dir" openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state" openclaw_live_prepare_staged_config @@ -444,6 +441,7 @@ DOCKER_RUN_ARGS=(docker run --rm -t \ -e OPENCLAW_DOCKER_AUTH_PRESTAGED="$DOCKER_AUTH_PRESTAGED" \ -e OPENCLAW_DOCKER_AUTH_DIRS_RESOLVED="$AUTH_DIRS_CSV" \ -e OPENCLAW_DOCKER_AUTH_FILES_RESOLVED="$AUTH_FILES_CSV" \ + -e OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}" \ -e OPENCLAW_LIVE_CLI_BACKEND_USE_CI_SAFE_CODEX_CONFIG="$CLI_USE_CI_SAFE_CODEX_CONFIG" \ -e OPENCLAW_DOCKER_CLI_BACKEND_PROVIDER="$CLI_PROVIDER" \ -e OPENCLAW_DOCKER_CLI_BACKEND_COMMAND_DEFAULT="$CLI_DEFAULT_COMMAND" \ diff --git a/scripts/test-live-codex-harness-docker.sh b/scripts/test-live-codex-harness-docker.sh index 1da4f4c85c9..46ba1b60c77 100644 --- a/scripts/test-live-codex-harness-docker.sh +++ b/scripts/test-live-codex-harness-docker.sh @@ -169,10 +169,7 @@ fi tmp_dir="$(mktemp -d)" source /src/scripts/lib/live-docker-stage.sh openclaw_live_stage_source_tree "$tmp_dir" -mkdir -p "$tmp_dir/node_modules" -cp -aRs /app/node_modules/. "$tmp_dir/node_modules" -rm -rf "$tmp_dir/node_modules/.vite-temp" -mkdir -p "$tmp_dir/node_modules/.vite-temp" +openclaw_live_stage_node_modules "$tmp_dir" openclaw_live_link_runtime_tree "$tmp_dir" openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state" openclaw_live_prepare_staged_config @@ -220,6 +217,7 @@ DOCKER_RUN_ARGS=(docker run --rm -t \ -e OPENCLAW_DOCKER_AUTH_PRESTAGED="$DOCKER_AUTH_PRESTAGED" \ -e OPENCLAW_CODEX_APP_SERVER_BIN="${OPENCLAW_CODEX_APP_SERVER_BIN:-codex}" \ -e OPENCLAW_DOCKER_AUTH_FILES_RESOLVED="$AUTH_FILES_CSV" \ + -e OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}" \ -e OPENCLAW_LIVE_CODEX_HARNESS_AUTH="$CODEX_HARNESS_AUTH_MODE" \ -e OPENCLAW_LIVE_CODEX_HARNESS=1 \ -e OPENCLAW_LIVE_CODEX_HARNESS_DEBUG="${OPENCLAW_LIVE_CODEX_HARNESS_DEBUG:-}" \ diff --git a/scripts/test-live-gateway-models-docker.sh b/scripts/test-live-gateway-models-docker.sh index 777f5209b7b..686090090d2 100755 --- a/scripts/test-live-gateway-models-docker.sh +++ b/scripts/test-live-gateway-models-docker.sh @@ -139,10 +139,7 @@ fi tmp_dir="$(mktemp -d)" source /src/scripts/lib/live-docker-stage.sh openclaw_live_stage_source_tree "$tmp_dir" -mkdir -p "$tmp_dir/node_modules" -cp -aRs /app/node_modules/. "$tmp_dir/node_modules" -rm -rf "$tmp_dir/node_modules/.vite-temp" -mkdir -p "$tmp_dir/node_modules/.vite-temp" +openclaw_live_stage_node_modules "$tmp_dir" openclaw_live_link_runtime_tree "$tmp_dir" openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state" openclaw_live_prepare_staged_config @@ -167,6 +164,7 @@ DOCKER_RUN_ARGS=(docker run --rm -t \ -e OPENCLAW_DOCKER_AUTH_PRESTAGED="$DOCKER_AUTH_PRESTAGED" \ -e OPENCLAW_DOCKER_AUTH_DIRS_RESOLVED="$AUTH_DIRS_CSV" \ -e OPENCLAW_DOCKER_AUTH_FILES_RESOLVED="$AUTH_FILES_CSV" \ + -e OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}" \ -e OPENCLAW_LIVE_TEST=1 \ -e OPENCLAW_LIVE_GATEWAY_MODELS="${OPENCLAW_LIVE_GATEWAY_MODELS:-modern}" \ -e OPENCLAW_LIVE_GATEWAY_PROVIDERS="${OPENCLAW_LIVE_GATEWAY_PROVIDERS:-}" \ diff --git a/scripts/test-live-models-docker.sh b/scripts/test-live-models-docker.sh index 7808cb13c3b..3e50892209b 100755 --- a/scripts/test-live-models-docker.sh +++ b/scripts/test-live-models-docker.sh @@ -169,10 +169,7 @@ fi tmp_dir="$(mktemp -d)" source /src/scripts/lib/live-docker-stage.sh openclaw_live_stage_source_tree "$tmp_dir" -mkdir -p "$tmp_dir/node_modules" -cp -aRs /app/node_modules/. "$tmp_dir/node_modules" -rm -rf "$tmp_dir/node_modules/.vite-temp" -mkdir -p "$tmp_dir/node_modules/.vite-temp" +openclaw_live_stage_node_modules "$tmp_dir" openclaw_live_link_runtime_tree "$tmp_dir" openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state" openclaw_live_prepare_staged_config @@ -198,6 +195,7 @@ DOCKER_RUN_ARGS=(docker run --rm -t \ -e OPENCLAW_DOCKER_AUTH_PRESTAGED="$DOCKER_AUTH_PRESTAGED" \ -e OPENCLAW_DOCKER_AUTH_DIRS_RESOLVED="$AUTH_DIRS_CSV" \ -e OPENCLAW_DOCKER_AUTH_FILES_RESOLVED="$AUTH_FILES_CSV" \ + -e OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}" \ -e OPENCLAW_LIVE_TEST=1 \ -e OPENCLAW_LIVE_MODELS="${OPENCLAW_LIVE_MODELS:-modern}" \ -e OPENCLAW_LIVE_PROVIDERS="${OPENCLAW_LIVE_PROVIDERS:-}" \