Skip to content

feat(webui): multi-stage build, omit dev deps, pre-build env-generator#492

Open
maany wants to merge 1 commit intorucio:release-38-LTSfrom
maany:webui-38-security
Open

feat(webui): multi-stage build, omit dev deps, pre-build env-generator#492
maany wants to merge 1 commit intorucio:release-38-LTSfrom
maany:webui-38-security

Conversation

@maany
Copy link
Member

@maany maany commented Feb 23, 2026

Summary

Backport of #491 for release-38 webui containers.

  • Split webui Dockerfile into a multi-stage build (builder + runtime), removing git and its transitive dependencies from the final image
  • Use npm install --omit=dev to exclude dev dependencies from production, reducing image size and attack surface
  • Pre-build the tools/env-generator TypeScript tool at image build time instead of compiling at every container startup
  • Replace wget with curl in the entrypoint since wget is no longer installed
  • Add setuptools downgrade workaround for AlmaLinux 9 compatibility

Security scan results (Docker Scout)

release-38.3.0 (before) After
Packages 2375 1158
CRITICAL 3 0
HIGH 27 7
MEDIUM 60 26
LOW 8 5
Total 98 38 (-61%)

Remaining vulnerabilities

7 HIGH — all packaged inside Next.js (next/dist/compiled/tar, next/dist/compiled/glob, next/dist/compiled/cross-spawn). These are pre-compiled into the Next.js package and cannot be fixed via npm overrides. Requires a Next.js version upgrade in the webui repo. For release 38, this would result in breaking changes.

20 of 26 MEDIUM — perl CVE-2023-47038 reported across 20 sub-packages. These are false positives: Docker Scout matches on the perl version (5.32.1) without checking the RPM release suffix (-481.1.el9_6) which contains the backported fix from ALSA-2024:2228. The installed version 5.32.1-481.1.el9_6 is newer than the fixed version 5.32.1-481.el9. Trivy correctly reports 0 OS-level HIGH/CRITICAL CVEs on the same image. Perl remains in the image as a runtime dependency of patchutils (provides filterdiff used in the entrypoint for patch application).

Split the Dockerfile into a builder stage (git clone + npm install) and
a runtime stage, removing git and its transitive dependencies from the
final image. Use --omit=dev to exclude dev dependencies from production.
Pre-build the env-generator tool during docker build so it no longer
needs to compile at container startup. Replace wget with curl in the
entrypoint since wget is no longer installed.
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.

1 participant