/nodejs-docker

The Node.js Docker image used by Google App Engine Flexible.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Google Cloud Platform Node.js Docker Image

Build Status

This repository contains the source for the gcr.io/google_appengine/nodejs docker image. This image can be used as the base image for running applications on Google App Engine Managed VMs, Google Container Engine, or any other Docker host.

This image is based on Debian Jessie and includes nodejs and npm installed from nodejs.org.

For a more thorough walk through of getting started with Node.js on Google Cloud Platform, please see the documentation and guides.

App Engine

To generate a Dockerfile that uses this image as a base, use the Cloud SDK. From your existing Node.js application:

gcloud beta app gen-config --custom

You can then modify the Dockerfile and .dockerignore as needed for you application.

Container Engine & other Docker hosts.

For other docker hosts, you'll need to create a Dockerfile based on this image that copies your application code and installs dependencies. For example:

    FROM gcr.io/google_appengine/nodejs

    # Copy application code.
    COPY . /app/

    # Install dependencies.
    RUN npm --unsafe-perm install

By default, the CMD is set to npm start. You can change this by specifying your own CMD or ENTRYPOINT.

Installing a different Node.js version

The image includes the install_node script that can be used to install a particular Node.js version. For example:

    FROM gcr.io/google_appengine/nodejs

    # Install node.js 4.6.1
    RUN install_node v4.6.1

    # Copy application code.
    COPY . /app/

    # Install dependencies.
    RUN npm --unsafe-perm install

Node.js is installed with binary packages hosted on a Google-provided mirror.

Contributing changes

Licensing