trickycoders / tiny-node-docker

Tiny Node Docker example.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is an example for how to build a teeny, tiny Docker image for your Node programs.

This example is an web server that prints Hello World and ends up in small Docker image:

1. Get dependencies

We only have one dependency, so let's get it and vendor it:

docker run --rm -v "$PWD":/app -w /app iron/node:dev npm install

2. Test it locally

docker run --rm -it -p 8080:8080 -v "$PWD":/app -w /app iron/node node server.js

Check localhost:8080 to ensure it's running.

3. Build image

docker build -t treeder/tiny-node:latest .

4. Test the image

Now that we built the image, let's run it.

docker run --rm -it -p 8080:8080 treeder/tiny-node

Surf to: http://localhost:8080/

Boom.

Fat version

To build the fat version, change all the iron/node bits to node:argon.

should initiate docker build

About

Tiny Node Docker example.


Languages

Language:JavaScript 100.0%