Automate Node Server with Docker and Gulp

Automate Node Server with Docker

To automate node server with using docker and gulp. first download the docker image for node server with following command

docker pull sfvishalgupta/imagenode:v0

Running the docker machine create the run.sh file with following code

#!/bin/bash
# setup app server
echo 'Cleaning up previous docker images'
docker rm -f nodeContainer
service apache2 stop

DIR=$( cd `dirname $0`/..; pwd )

docker run -tid \
	--name nodeContainer \
	-p 80:3000 \
	-v ${DIR}/:/var/www/html \
	-v ${DIR}/bin/init.sh:/init.sh \
	-w /var/www/html \
	sfvishalgupta/imagenode:v0 \
    /init.sh

docker ps

Read more

NPM Commands

NPM Commands

Generate package.json in a module directory, based on npm parmaters.


npm init

#Install a package and also update package.json with the installed version and package name.
npm install  --save

#Install a package and also update package.json with the installed version and package name, but into the devDependencies section.
npm install  --save-dev

#Set --save as a default for npm install
npm config set save true

#List all npm configuration flags.
npm config ls -l

#install a version not from a git repository and not from the npm directory, for example:
npm install git://github.com/substack/node-browserify.git

#Update the global npm version.
npm update npm -g

#Uninstall package (A nice thing about npm is you can always just rm -rf ./node_modules/).
npm uninstall 

#Test & Show the full dependency tree
npm install --dry-run

#List outdated libraries compared to currently installe node_modules:
npm outdated

#Lock down dependency versions:
npm shrinkwrap

#Easter Eggs
whatever-smiley
npm xmas
npm visnup
npm substack