Public | Automated Build

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

io.js + Bower/Gulp Runtime Docker image

This Docker image is essentially the same thing as dockerfile/nodejs-bower-gulp-runtime, with the following changes:

  • It's running io.js instead of Node.js, allowing ES6 scripts to be executed (ex: Koa) without the --harmony flag.
  • It copies over a .bowerrc file (if it exists) before running bower install.
  • It passes the exposed port (8080) to the node process via the PORT env variable.

Base Docker Image

Installation

  1. Install Docker.

  2. Download automated build from public Docker Hub Registry: docker pull twistedstream/nodejs-es6-bower-gulp-runtime

(alternatively, you can build an image from Dockerfile: docker build -t="twistedstream/nodejs-es6-bower-gulp-runtime" github.com/twistedstream/docker_nodejs-es6-bower-gulp-runtime)

Usage

This image assumes that your application:

  • has a file named package.json listing its dependencies.
  • has a file named bower.json listing its dependencies.
  • might have a file named .bowerrc specifying Bower configuration.
  • has a file named Gulpfile.js with a build task.
  • has a file named server.js as the entrypoint script or define in package.json the attribute: "scripts": {"start": "node <entrypoint_script_js>"}
  • listens on port 8080 or uses the port passed by the PORT env variable.

When building your application docker image, ONBUILD triggers install NPM module dependencies of your application using npm install.

  • Step 1: Create a Dockerfile in your io.js application directory with the following content:
FROM twistedstream/nodejs-es6-bower-gulp-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/"
Docker Pull Command
Owner
twistedstream