Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

Node.js w/ Bower & Grunt runtime Dockerfile (with image support)

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 - dockerfile/nodejs-bower-grunt

Installation

Optional - docker will download the image if needed when you build your nodejs docker application image.

  1. Download an automated build from the public Docker Hub Registry: docker pull pdmurray/nodejs-bower-grunt-runtime:image-support

    (alternatively, you can build an image from Dockerfile: docker build -t="pdmurray/nodejs-bower-grunt-runtime" github.com/pdmurray/nodejs-bower-grunt-runtime/tree/image-support)

Usage

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 build task.
  • builds to a dist folder with a package.json file that should be installed with npm install --production.
  • has a file named server.js as the entrypoint script or defines a start script in package.json: "scripts": {"start": "node <entrypoint_script_js>"}
  • uses process.env.NODE_ENV to determine production environment.
  • listens on port 9000

When building your application docker image, ONBUILD triggers NPM to install your application's dependencies.

  • Step 1: Create a Dockerfile in your Node.js application directory with the following content. Note, you must use the image-support tag to get ruby/sass/ffmpeg support.
    FROM pdmurray/nodejs-bower-grunt-runtime:image-support
  • 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 9000:
    APP=$(docker run -d -p 9000 app)
    PORT=$(docker port $APP 9000 | awk -F: '{print $2}')
    echo "Open http://localhost:$PORT/"

Branches

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 [pdmurray/nodejs-bower-grunt-runtime:image-support] - adds graphicsmagick, imagemagick and ffmpeg to the base image
Docker Pull Command
Owner
pdmurray

Comments (0)