A barebones Node.js app using Express 4.
Make sure you have Node.js and the Heroku Toolbelt installed.
git clone git@github.com:heroku/node-js-sample.git # or clone your own fork
cd node-js-sample
npm install
npm start
Your app should now be running on localhost:5000.
heroku create
git push heroku master
heroku open
Go to the directory that has your Dockerfile and run the following command to build the Docker image. The -t flag lets you tag your image so it's easier to find later using the docker images command:
docker build -t <your username>/node-web-app .
Running your image with -d runs the container in detached mode, leaving the container running in the background. The -p flag redirects a public port to a private port inside the container. Run the image you previously built:
docker run -p 5000:5000 -d <your username>/node-web-app
Print the output of your app:
# Get container ID
$ docker ps
# Print app output
$ docker logs <container id>
# Example
Running on http://localhost:5000