Sign inSign up

amble/nodemonjs-pi

By amble

Updated over 9 years ago

lightweight nodejs-container with daemonized startup via nodemon.io - raspberry pi ready.

Image
0

1.2K

amble/nodemonjs-pi repository overview

information:

based on hypriot-iojs, incl. node v1.4.1 & npm v2.6.0 extended by nodemon v.1.11.0

running on any armv7 / armv71 compatible with armv8

usage:
  • mkdir & pull docker-container
  • add package.json & a startup js
  • add a compose-file to your project
  • docker-compose up -d OR
  • docker run -p 8080:8080 -v $PWD:/src -d amble/nodemonjs-pi nodemon index.js

example compose:
    version: "2"
    services:
      web:
        image: amble/nodemonjs-pi
        container_name: nodemonjs-app
        expose:
          - "8080"
        ports:
          - "8080:8080"
        volumes:
          - .:/src
        command:
          nodemon index.js
example package.json:
{
  "name": "my-nodejs-app",
  "version": "0.0.1",
  "description": "raspberry pi meets nodemon docker",
  "main": "server.js",
  "author": "amble",
  "dependencies": {
    "body-parser": "^1.4.3",
    "express": "^4.13.4",
    "method-override": "^2.1.3",
    "morgan": "^1.1.1"
  }
}
example index.js
var express = require('express');
var app = express(); 		
app.get('/about', function (req, res) {
        console.log('on about');
});

how to test
  • connect to http://pi.local:8080
  • fg your nodemon process
  • change index.js on your local pi filesystem
  • watch the daemon restart your nodejs app:
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
Running on http://localhost:8080
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
Running on http://localhost:8080/about

Licence

Copyright © 2016, 2017 mbl - Licenced under GPL-3.

Tag summary

Content type

Image

Digest

Size

55.4 MB

Last updated

over 9 years ago

docker pull amble/nodemonjs-pi