Giter Site home page Giter Site logo

stackriot / nodejs-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/nodejs-docker

0.0 1.0 0.0 1.31 MB

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

Home Page: https://cloud.google.com/nodejs

License: Apache License 2.0

Shell 19.76% JavaScript 12.96% TypeScript 63.97% Dockerfile 3.31%

nodejs-docker's Introduction

Google Cloud Platform Node.js Docker Image

Build Status

This repository contains the source for the Google-maintained Node.js docker image. This image can be found at launcher.gcr.io/google/nodejs or gcr.io/google-appengine/nodejs and can be used as the base image for running applications on Google App Engine Flexible, Google Kubernetes Engine, or any other Docker host.

This image is based on Ubuntu 16.0.4 and includes nodejs and npm installed from nodejs.org and yarn installed from yarnpkg.com.

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.

Kubernetes Engine and 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 launcher.gcr.io/google/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.

For a full example on deploying an application to Google Kubernetes Engine, see this tutorial.

Kubernetes Configuration

This image assumes your application listens on port 8080. To run an application based on this image inside a Kubernetes pod, you can use a Pod configuration like this:

kind: Pod
metadata:
  name: app
  namespace: default
spec:
  containers:
  - image: $IMAGE_NAME
    imagePullPolicy: IfNotPresent
    name: app
    ports:
    - containerPort: 8080
  restartPolicy: Always

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 launcher.gcr.io/google/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. Before installing the specified version of Node.js, checks are performed to verify that the associated binary is an official Node.js release. The install_node script will refuse to install a binary that fails this verification.

To override this behavior, and force the installation of the binary, pass the --ignore-verification-failure flag to install_node. However, it is highly recommended that you only install Node.js binaries that have been successfully verified.

Contributing changes

Licensing

nodejs-docker's People

Contributors

bendory avatar calvinmetcalf avatar cristiancavalli avatar dlorenc avatar dominickramer avatar donmccasland avatar imjasonh avatar jeadorf avatar jinglundong avatar jinwoo avatar justinbeckwith avatar kennethye1 avatar kjin avatar kyleamathews avatar langri-sha avatar louisgv avatar matthewloring avatar matthieulemoine avatar mindhog avatar msuozzo avatar nkubala avatar ofrobots avatar paul-feng-github avatar pmaloogoogle avatar proppy avatar raggi avatar rrch avatar sharifelgamal avatar swalkowski avatar vvo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.