Skip to content

Instantly share code, notes, and snippets.

@dustyfresh
Last active December 11, 2015 06:01
Show Gist options
  • Save dustyfresh/eac54cd96d7b88ff25b9 to your computer and use it in GitHub Desktop.
Save dustyfresh/eac54cd96d7b88ff25b9 to your computer and use it in GitHub Desktop.
Nodejs in a Debian Jessie environment packaged in a docker container.

Dockerfile:

FROM debian:jessie
MAINTAINER dustyfresh, https://github.com/dustyfresh

RUN apt-get update && \
	apt-get install --yes curl build-essential && \
	curl -sL https://deb.nodesource.com/setup_5.x | bash - && \
	apt-get install --yes nodejs

Create a src directory where you will run your code from:

$ mkdir -v src
mkdir: created directory 'src'

Build your docker image:

$ docker build --rm -t node-debian .

Run your code in the container from src/hello.js:

$ cat src/hello.js
console.log("Hello docker and node!");

$ docker run -e "NODE_PATH=/usr/lib/node_modules" -v $(pwd)/src:/opt/node --name node-debian --rm -i -t node-debian bash -c 'node /opt/node/hello.js'
Hello docker and node!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment