Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2014 15:15
Show Gist options
  • Save thom-nic/724a2af410e90a654e35 to your computer and use it in GitHub Desktop.
Save thom-nic/724a2af410e90a654e35 to your computer and use it in GitHub Desktop.
Node.js Dockerfile based on ubuntu 14.04. This is a little smaller than dockerfile/nodejs which depends on python
# Node.js app Docker file
FROM ubuntu:14.04
MAINTAINER Thom Nichols ""
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -qq update
RUN apt-get install -y nodejs npm
# TODO could uninstall some build dependencies
# fucking debian installs `node` as `nodejs`
RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
VOLUME ["/data"]
ADD . /data
RUN cd /data && npm install
CMD ["npm", "start"]
Copy link

Charl13 commented Nov 21, 2017

Or use nodesource.

RUN curl -sL | bash && \
    apt-get install -y nodejs build-essential


Copy link

@Charl13 I am using the commands mentioned by you but I want to install a particular version as in 8.9.4. The above command only asks for a major version but I want this specific one. How can I achieve this ?

Copy link

arashkevich25 commented May 15, 2018

I have problem while try run nodemon

/data/node_modules/nodemon/bin/nodemon.js:15 server_1 | require('update-notifier')({ pkg }).notify(); server_1 | ^ server_1 | SyntaxError: Unexpected token } server_1 | at Module._compile (module.js:439:25) server_1 | at Object.Module._extensions..js (module.js:474:10) server_1 | at Module.load (module.js:356:32) server_1 | at Function.Module._load (module.js:312:12) server_1 | at Function.Module.runMain (module.js:497:10) server_1 | at startup (node.js:119:16) server_1 | at node.js:902:3 server_1 | npm ERR! weird error 8 server_1 | npm WARN This failure might be due to the use of legacy binary "node" server_1 | npm WARN For further explanations, please read server_1 | /usr/share/doc/nodejs/README.Debian server_1 | server_1 | npm ERR! not ok code 0

Copy link

thanks , helped

Copy link

I need to install node.js 8.12.0 inside docker file
RUN curl -sL | bash -
RUN apt-get -y install nodejs
I have tried with these two commands but error response 100, I got
Can anyone may be help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment