Skip to content

fix(ui): optimize UI Docker build and fix EMFILE on npm ci - #369

Open
atripathy86 wants to merge 1 commit into
HewlettPackard:masterfrom
atripathy86:fix/ui-npm-build-optimization
Open

fix(ui): optimize UI Docker build and fix EMFILE on npm ci#369
atripathy86 wants to merge 1 commit into
HewlettPackard:masterfrom
atripathy86:fix/ui-npm-build-optimization

Conversation

@atripathy86

Copy link
Copy Markdown
Collaborator

npm install with ~1500 packages in a rootless container calls fchown() on every extracted file. Each EINVAL failure cascades into additional error-handler fd opens, exhausting the container's default nofile limit (1024 in buildah/runc) with EMFILE / exit 232.

  • Replace 4 ad-hoc npm install RUN steps with a single npm ci
  • Add --unsafe-perm to suppress fchown calls that fail in rootless builds
  • Add --legacy-peer-deps, --no-audit, --no-fund to reduce fd and I/O pressure
  • Use isolated cache path (--cache /tmp/.npm) to avoid cross-build contention
  • Add NODE_OPTIONS=--max-old-space-size=4096 for webpack compilation headroom
  • Move svg.js and d3 from Dockerfile installs into package.json dependencies
  • Regenerate package-lock.json to include svg.js and d3 for npm ci validity

Related Issues / Pull Requests

#368

Description

Include a brief summary of the proposed changes.

What changes are proposed in this pull request?

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected; for instance,
    examples in this repository need to be updated too).
  • This change requires a documentation update.

Checklist:

  • My code follows the style guidelines of this project (PEP-8 with Google-style docstrings).
  • My code modifies existing public API, or introduces new public API, and I updated or wrote docstrings that
    uses Google-style formatting and any other formatting that is supported by mkdocs and plugins this project
    uses.
  • I have commented my code.
  • My code requires documentation updates, and I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

npm install with ~1500 packages in a rootless container calls fchown()
on every extracted file. Each EINVAL failure cascades into additional
error-handler fd opens, exhausting the container's default nofile limit
(1024 in buildah/runc) with EMFILE / exit 232.

- Replace 4 ad-hoc npm install RUN steps with a single npm ci
- Add --unsafe-perm to suppress fchown calls that fail in rootless builds
- Add --legacy-peer-deps, --no-audit, --no-fund to reduce fd and I/O pressure
- Use isolated cache path (--cache /tmp/.npm) to avoid cross-build contention
- Add NODE_OPTIONS=--max-old-space-size=4096 for webpack compilation headroom
- Move svg.js and d3 from Dockerfile installs into package.json dependencies
- Regenerate package-lock.json to include svg.js and d3 for npm ci validity

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses UI container build failures (EMFILE / exit 232) in rootless Podman by making the UI dependency install more deterministic and less FD-intensive during image builds, and by moving ad-hoc Dockerfile installs into the UI’s normal dependency graph.

Changes:

  • Consolidate UI image dependency installation into a single npm ci step with build-focused flags and a dedicated npm cache path.
  • Add d3 and svg.js to ui/package.json and regenerate ui/package-lock.json to keep npm ci valid.
  • Add NODE_OPTIONS=--max-old-space-size=4096 for webpack build headroom.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
ui/package.json Adds d3 and svg.js as declared dependencies so Docker builds can rely on npm ci rather than ad-hoc installs.
ui/package-lock.json Regenerated lockfile to include the new dependencies and align installs with npm ci.
ui/Dockerfile Replaces multiple npm install layers with a single npm ci invocation and adds Node memory options for build stability.
Files not reviewed (1)
  • ui/package-lock.json: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/package.json
Comment on lines +23 to +25
"papaparse": "^5.5.2",
"svg.js": "*",
"d3": "*"
Comment thread ui/package.json
Comment on lines +24 to +25
"svg.js": "*",
"d3": "*"
Comment thread ui/Dockerfile
Comment on lines +11 to +12
# --unsafe-perm skips fchown calls that fail in rootless Podman and cause EMFILE cascade
RUN npm ci --legacy-peer-deps --no-audit --no-fund --unsafe-perm --cache /tmp/.npm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants