This repository contains a Dockerfile that builds a Node.js w/ Bower & Grunt runtime. It is also the base for an automated build that is maintained on the public Docker Hub Registry.
This is a base image for deploying/running your Node.js applications.
It can automatically bundle a Node.js application with its dependencies and set the default command with no additional Dockerfile instructions.
This project was heavily inspired by code from: dockerfile/nodejs-bower-grunt-runtime.
Base Docker Image - digitallyseamless/nodejs-bower-grunt
Optional - docker will download the image if needed when you build your nodejs docker application image.
-
Download an automated build from the public Docker Hub Registry:
docker pull digitallyseamless/nodejs-bower-grunt-runtime(alternatively, you can build an image from Dockerfile:
docker build -t="digitallyseamless/nodejs-bower-grunt-runtime" github.com/DigitallySeamless/nodejs-bower-grunt-runtime)
This image assumes that your application:
- has a file named package.json listing its dependencies.
- has a file named bower.json listing any client dependencies.
- has a file named .bowerrc, used to configure bower.
- has a file named Gruntfile.js that registers a
buildtask. - builds to a
distfolder with apackage.jsonfile that should be installed withnpm install --production. - has a file named
server.jsas the entrypoint script or defines astartscript in package.json:"scripts": {"start": "node <entrypoint_script_js>"} - uses
process.env.NODE_ENVto determineproductionenvironment. - listens on port
8080
When building your application docker image, ONBUILD triggers NPM to install your application's dependencies.
- Step 1: Create a Dockerfile in your
Node.jsapplication directory with the following content:
FROM digitallyseamless/nodejs-bower-grunt-runtime- Step 2: Build your container image by running the following command in your application directory:
docker build -t="app" .- Step 3: Run application by mapping port
8080:
APP=$(docker run -d -p 8080 app)
PORT=$(docker port $APP 8080 | awk -F: '{print $2}')
echo "Open http://localhost:$PORT/"This repo also includes "feature branches" that add various libraries and other components to the base image. Each feature branch is an automated build as well, and is tagged in the Docker Hub Registry by it's branch name.
- image-support [
digitallyseamless/nodejs-bower-grunt-runtime:image-support] - addsgraphicsmagickandimagemagickto the base image - compass-support [
digitallyseamless/nodejs-bower-grunt-runtime:compass-support] - addsrubyandruby-compassto the base image