Skip to content

Webui Dockerfile: multi-stage build, upgrade to AlmaLinux 10 + Node.js 24#491

Open
maany wants to merge 2 commits intorucio:masterfrom
maany:webui-container-security
Open

Webui Dockerfile: multi-stage build, upgrade to AlmaLinux 10 + Node.js 24#491
maany wants to merge 2 commits intorucio:masterfrom
maany:webui-container-security

Conversation

@maany
Copy link
Member

@maany maany commented Feb 23, 2026

Summary

  • Split webui Dockerfile into a multi-stage build (builder + runtime), removing git and its transitive dependencies from the final image
  • Upgrade to AlmaLinux 10 + Node.js 24 LTS: ships Python 3.12 natively, eliminating the python39 package and the setuptools downgrade workaround. Node.js 24 LTS has active support until October 2026, full maintenance until April 2028.
  • 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. The entrypoint falls back to building on-the-fly only if the pre-built artifact is missing (e.g. when patches replace it).
  • Replace wget with curl in the entrypoint since wget is no longer installed

See #492 for the equivalent changes backported to release-38 webui containers.

Security scan results (Docker Scout)

Scanned with webui tag 39.3.5:

Count
Packages 1076
CRITICAL 0
HIGH 9
MEDIUM 2
LOW 3
Total 14

Remaining vulnerabilities

9 HIGH — all vendored inside Next.js (next/dist/compiled/):

Package CVEs Source
tar@7.5.1 4 HIGH (CVE-2026-23950, CVE-2026-24842, CVE-2026-23745, CVE-2026-26960) next/dist/compiled/tar/
minimatch@10.0.3 1 HIGH (CVE-2026-26996) next/dist/compiled/
minimatch@9.0.5 1 HIGH (CVE-2026-26996) next/dist/compiled/
glob@10.4.5 1 HIGH (CVE-2025-64756) next/dist/compiled/glob/
glob@11.0.3 1 HIGH (CVE-2025-64756) next/dist/compiled/glob/
@isaacs/brace-expansion@5.0.0 1 HIGH (CVE-2026-25547) next/dist/compiled/

These are pre-compiled into the Next.js package itself and cannot be fixed via npm overrides. Requires a Next.js version upgrade in the webui repo.

2 MEDIUMpip@23.3.2 (CVE-2023-5752, CVE-2025-8869). System pip on AlmaLinux 10.

3 LOWdiff@8.0.2, pm2@6.0.14, pip@23.3.2. No fixes available for pm2/diff.

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. Pre-build the env-generator tool during the build stage so
it no longer needs to compile at container startup. Replace wget with
curl in the entrypoint since wget is no longer installed.
Replace AlmaLinux 9 with AlmaLinux 10, gaining Python 3.12 natively and
removing the setuptools downgrade workaround. Upgrade Node.js from 20 to
24 LTS (supported until April 2028) via nodejs24/nodejs24-npm packages
with /usr/local/bin symlinks for node/npm/npx compatibility.
ARG TAG

LABEL stage=production
ENV NODE_ENV=production
Copy link
Member

Choose a reason for hiding this comment

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

NODE_ENV should probably be set to production, also in the builder image.

Comment on lines 31 to 33
COPY j2.py /usr/local/bin/
RUN python3 -m pip install --no-cache-dir jinja2 && \
ln -s j2.py /usr/local/bin/j2
Copy link
Member

Choose a reason for hiding this comment

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

as far as I can tell, you do not need j2 in the builder image

webui/Dockerfile Outdated
Comment on lines 68 to 73
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir --upgrade setuptools

COPY j2.py /usr/local/bin/
RUN python3 -m pip install --no-cache-dir jinja2 && \
ln -s j2.py /usr/local/bin/j2
Copy link
Member

Choose a reason for hiding this comment

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

instead of installing pip and jinja2 via pip, you could use dnf to install python3 python3-jinja2 in the runtime image


# Pre-build env-generator so it's ready at runtime
WORKDIR /opt/rucio/webui/tools/env-generator
RUN npm install && npx tsc --skipLibCheck && cp -rf src/templates dist/
Copy link
Member

Choose a reason for hiding this comment

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

runs npm install with dev dependencies (see comment about NODE_ENV above)


RUN python3 -m pip install --no-cache-dir --upgrade pip && \
python3 -m pip install --no-cache-dir --upgrade setuptools
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools
Copy link
Member

Choose a reason for hiding this comment

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

do not merge pip and setuptools in one pip install --upgrade, this lead to pip not being able to resolve versions in the past. Same below.

dnf -y module enable nodejs:20 && \
dnf -y module install nodejs:20/common && \
dnf -y install httpd mod_ssl python39 python-pip procps patch patchutils && \
dnf -y install nodejs24 nodejs24-npm httpd mod_ssl python3-pip procps patch patchutils && \
Copy link
Member

Choose a reason for hiding this comment

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

remove python3-pip and add python3 and python3-jinja2, so you can get rid of the pip commands below (as stated in the other comment)

Comment on lines +20 to +22
ln -s /usr/bin/node-24 /usr/local/bin/node && \
ln -s /usr/bin/npm-24 /usr/local/bin/npm && \
ln -s /usr/bin/npx-24 /usr/local/bin/npx
Copy link
Member

Choose a reason for hiding this comment

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

Really surprised to see this. I saw the module system being dropped, but is there really no replacement?

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