Context
The sandbox script's _copy_tree (scripts/sandbox.py:106) copies prerequisite directories into a temp build context using os.walk(followlinks=True). It doesn't skip files/dirs excluded by .dockerignore, so untracked directories like .pnpm-store (which has a recursive content-addressed structure) cause:
OSError: [Errno 63] File name too long: '.../jupyter/utils/addons/.pnpm-store/v10/projects/.../.pnpm-store/v10/projects/.../.pnpm-store/...'
Why not just skip all hidden directories?
Blanket-skipping directories starting with . won't work — codeserver images need .git (COPY .git /root/.git in codeserver/ubi9-python-3.12/Dockerfile.cpu). The root .dockerignore explicitly documents this:
# .git/ is intentionally NOT ignored: the Dockerfile needs it to resolve the
# code-server git submodule (COPY .git ...). Ensure CI uses a shallow clone.
Proposed approach
Read .dockerignore from the repo root and extract simple directory name patterns to filter during os.walk. No new dependencies needed — use stdlib only.
- Add
_load_dockerignore(root) — parse .dockerignore, skip comments and blanks
- Add
_ignored_dir_names(root) — extract directory names from patterns like **/node_modules/, **/.pnpm-store/, node_modules/ by stripping **/ prefix and / suffix. Path-based patterns (like ci/) are ignored since they don't apply inside prerequisite subdirectories.
- Modify
_copy_tree — accept dir_ignore_names: set[str] parameter, filter dirnames in-place:
if dir_ignore_names:
dirnames[:] = [d for d in dirnames if d not in dir_ignore_names]
- Update
setup_sandbox — compute ignore set once, pass to all _copy_tree calls
Current .dockerignore patterns this would handle
**/node_modules/ → skip "node_modules" dirs
**/.pnpm-store/ → skip ".pnpm-store" dirs (added in separate fix)
Workaround
Until this is fixed, remove the problematic directory:
rm -rf jupyter/utils/addons/.pnpm-store
Or add .pnpm-store/ to .gitignore and .dockerignore (already done in PR #3142).
Context
The sandbox script's
_copy_tree(scripts/sandbox.py:106) copies prerequisite directories into a temp build context usingos.walk(followlinks=True). It doesn't skip files/dirs excluded by.dockerignore, so untracked directories like.pnpm-store(which has a recursive content-addressed structure) cause:Why not just skip all hidden directories?
Blanket-skipping directories starting with
.won't work —codeserverimages need.git(COPY .git /root/.gitincodeserver/ubi9-python-3.12/Dockerfile.cpu). The root.dockerignoreexplicitly documents this:Proposed approach
Read
.dockerignorefrom the repo root and extract simple directory name patterns to filter duringos.walk. No new dependencies needed — use stdlib only._load_dockerignore(root)— parse.dockerignore, skip comments and blanks_ignored_dir_names(root)— extract directory names from patterns like**/node_modules/,**/.pnpm-store/,node_modules/by stripping**/prefix and/suffix. Path-based patterns (likeci/) are ignored since they don't apply inside prerequisite subdirectories._copy_tree— acceptdir_ignore_names: set[str]parameter, filterdirnamesin-place:setup_sandbox— compute ignore set once, pass to all_copy_treecallsCurrent
.dockerignorepatterns this would handleWorkaround
Until this is fixed, remove the problematic directory:
Or add
.pnpm-store/to.gitignoreand.dockerignore(already done in PR #3142).