ncarlier/webhookd

Unable to install nodejs specific version

lexoyo opened this issue · 4 comments

Hello,

Thank you for this awesome project !

I use my custom Dockerfile and I need a specific version of nodejs to run the nodejs scripts

I tried these methods in the Dockerfile without success:

Method 1 refuses to install nodejs (nodejs-current-17.9.0-r0: breaks: world[nodejs=14.19.0])

FROM ncarlier/webhookd:1.15.0
RUN apk add --update nodejs=14.19.0

Method 2 installs nvm but node is not available to run the scripts (env: can't execute 'node': No such file or directory)

FROM ncarlier/webhookd:1.15.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
RUN source $HOME/.nvm/nvm.sh && nvm install 14

I would love to use webhookd in silex v3 💯

Have a nice day

Hello,

thank you for your interest.
Using NVM with Alpine is a bit complicated. Here is a working example:

FROM ncarlier/webhookd:1.15.0
SHELL ["/bin/bash", "-c"]
RUN apk add --update alpine-sdk gcompat coreutils
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
RUN cd $HOME && source $HOME/.nvm/nvm.sh && nvm install 14
RUN cd $HOME && source $HOME/.nvm/nvm.sh && nvm use 14 && node --version

You may have to call nvm in your script to setup the PATH variable.

Have a nice day too

Hello again

Thanks so much for the quick answer

It is indeed what I need, but as you said, I have to "You may have to call nvm in your script to setup the PATH variable."

But then I can not call nodejs scripts directly right? You're saying i need to call a shell script which calls my nodejs script right?

You can call your nodejs script directly as long as the script is executable (chmod +x) and the file header is #!/usr/bin/env node
But in this case, node must be in the PATH. Using nvm, you may have to set the path manually (with the node version).
Otherwise you create a script that sources nvm and uses the correct version.

Thank you it works as you said