perf(cli): cache the Node install layer across source-only changes

The generated Node Dockerfile copies source before running the install, so
the first source change invalidates the install layer and every dependency
is reinstalled. A production build showed 0/3 steps cached with `npm ci`
rebuilding at 16.9s.

Copy `package.json` and the lockfile first instead. Falls back to the
current output when there is no lockfile, when an install lifecycle hook is
present, when a custom install command is set, or when the config is nested
in a workspace.
This commit is contained in:
Elior Nataf Lackritz
2026-08-12 15:39:54 -04:00
parent 644815f9e5
commit 77fbf25d41
3 changed files with 206 additions and 10 deletions
+1 -1
View File
@@ -1019,7 +1019,7 @@ def python_config_to_docker_uv_lock(
docker_plan.add_instruction("WORKDIR", plan.working_dir)
docker_plan.add_instruction(
"RUN",
f"{_get_node_pm_install_cmd(plan.target_root)} && "
f"{_get_node_pm_install_cmd(plan.target_root)[0]} && "
"tsx /api/langgraph_api/js/build.mts",
)
docker_plan.add_raw("# -- End of JS dependencies install --")