Skip to content

fix: reduce "openedx" image size and fix Node/npm CVEs - #1557

Open
Faraz32123 wants to merge 2 commits into
overhangio:mainfrom
edly-io:faraz/slim-openedx-image
Open

Faraz32123 wants to merge 2 commits into
overhangio:mainfrom
edly-io:faraz/slim-openedx-image

Conversation

@Faraz32123

Copy link
Copy Markdown
Contributor

Part of #1543 — the "fix what we own" half, complementing the weekly scan in #1545.

  • ~600MB smaller image: the uv package cache no longer leaks into image layers (~380MB), and the extracted Node tarball is dropped from /openedx/nodeenv/src (~200MB).
  • Node 24.22.3 + npm 11.21.2: fixes the November 2026 Node security release CVEs and the vendored undici/brace-expansion CVEs in npm. Trivy CRITICAL/HIGH findings in Tutor-installed components: 12 → 0 (the rest live in edx-platform's pinned dependencies).

Tested by building openedx and openedx-dev from scratch and running a full tutor dev stack on the result (LMS/CMS healthy), with before/after Trivy scans — testing done with Claude's help.

🤖 Generated with Claude Code

Slim the image by about 600MB and clear every Trivy CRITICAL/HIGH
finding in components that Tutor itself installs:

- Keep the uv/pip cache out of image layers: build stages share a
  BuildKit cache mount, and all later stages (production, development,
  plugin patches) now disable the installer caches entirely, instead of
  leaking ~380MB into the layers.
- Drop the extracted Node tarball from /openedx/nodeenv/src (~200MB):
  unused at runtime, and it duplicated every npm CVE finding.
- Upgrade Node.js 24.22.1 -> 24.22.3 (November 2026 security release)
  and npm -> 11.21.2, whose vendored undici 6.29.1 and brace-expansion
  5.0.12 fix the remaining known vulnerabilities.

Part of overhangio#1543

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@ahmed-arb ahmed-arb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, one fix: the npm self-upgrade should go through NPM_REGISTRY so mirror-only builds don't break.

Comment on lines 172 to 175
RUN npm install -g npm@11.21.2

# Install nodejs requirements
ARG NPM_REGISTRY={{ NPM_REGISTRY }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
RUN npm install -g npm@11.21.2
# Install nodejs requirements
ARG NPM_REGISTRY={{ NPM_REGISTRY }}
ARG NPM_REGISTRY={{ NPM_REGISTRY }}
RUN --mount=type=cache,target=/root/.npm,sharing=shared \
npm install -g npm@11.21.2 --registry=$NPM_REGISTRY
# Install nodejs requirements

Route the npm self-upgrade through the NPM_REGISTRY build arg and the
shared npm cache mount, so builds that rely on a private registry
mirror keep working. Addresses review feedback on overhangio#1557.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Triage

Development

Successfully merging this pull request may close these issues.

2 participants