Skip to content

update dockerfile to install node 22 using nvm - #569

Open
GnsP wants to merge 1 commit into
cdapio:developfrom
GnsP:fix-node-installation
Open

update dockerfile to install node 22 using nvm#569
GnsP wants to merge 1 commit into
cdapio:developfrom
GnsP:fix-node-installation

Conversation

@GnsP

@GnsP GnsP commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

In the dockerfile we were installing the now unsupported node v10 using the older installation method.
This PR updates the dockerfile to install node v22 using nvm

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Dockerfile to install Node.js using NVM instead of apt-get. However, the specified Node.js version (22.22.3) does not exist, which will cause the build to fail. Additionally, using NVM in a Dockerfile introduces unnecessary complexity; it is recommended to directly download and extract the official Node.js binary tarball to /usr/local instead.

Comment thread Dockerfile
Comment on lines +28 to +31
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
bash -c '. "$NVM_DIR/nvm.sh" && nvm install 22.22.3' && \
export PATH="$NVM_DIR/versions/node/v22.22.3/bin:$PATH" && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

There are two main issues with the current approach:

  1. Invalid Node.js Version: Node.js version 22.22.3 does not exist. Attempting to install this non-existent version will cause the build to fail.
  2. Unnecessary Complexity with NVM: Using nvm in a Dockerfile is generally discouraged because it is designed for interactive shells and managing multiple versions. For a Docker container, installing a single Node.js version directly is much cleaner, faster, and avoids the need to source environment files or manually update the PATH variable.

Recommendation:
Download and extract the official Node.js binary tarball directly to /usr/local.

    curl -fsSL https://nodejs.org/dist/v22.12.0/node-v22.12.0-linux-x64.tar.gz | tar -xzf - --strip-components=1 -C /usr/local && \

@sonarqubecloud

Copy link
Copy Markdown

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