-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
source nvm.sh in dockerfile onbuild not work #3493
Comments
nvm.sh has to be sourced in every RUN command, i believe. nvm already provides a dockerfile on dockerhub; is there a reason you cant use that? |
Yes, I use in this way. But want to optimize, is possible? |
I'm not sure what you'd need to optimize, but the way to have a user not need to know nvm exists is just setting the default alias. |
I mean user can skip source nvm.sh and use default node directly in docker image build |
That's not something you can really do in a practical sense. You could, I suppose, hardcode the PATH - but why wouldn't you just want the user to have nvm available? |
set path seems not a good practice, because other env config also need to be set, such as node_modules dir I provide base builder image for users with multi node version option, but most of them use npm directly in dockerfile, I have to notify them add source nvm.sh in one RUN command, lot of communication work. I need nvm set a default version and can be used directly, when need change version then source nvm.sh is acceptable. |
I'm not sure if this is possible, although I suspect nvm's own dockerfile allows this. cc @PeterDaveHello for the docker question |
What's the scenario for this request? Does the user need to switch between different node.js versions in a Docker image? |
Yes, some user need 16, someone need 18, I just want provide only one base image |
Maybe using |
I tried ENTRYPOINT, but source only effect in new forked shell, so not work |
So, what's your |
My situation is:
1 base:builder docker image
another dockerfile to build front-end app:
nvm command not found error.
I tried ONBUILD bash -c "source $NVM_DIR/nvm.sh" got the same problem, I just want to create one base builder image, user can ignore setup nvm and use node directly.
The text was updated successfully, but these errors were encountered: