update dockerfile to install node 22 using nvm - #569
Open
GnsP wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
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 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" && \ |
There was a problem hiding this comment.
There are two main issues with the current approach:
- Invalid Node.js Version: Node.js version
22.22.3does not exist. Attempting to install this non-existent version will cause the build to fail. - Unnecessary Complexity with NVM: Using
nvmin 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 thePATHvariable.
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 && \
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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