$ docker pull registry.access.redhat.com/openshift3/nodejs-010-rhel7 $ docker pull registry.access.redhat.com/rhscl/nodejs-4-rhel7
OpenShift Origin provides S2I enabled Node.js images for building and running Node.js applications. The Node.js S2I builder image assembles your application source with any required dependencies to create a new image containing your Node.js application. This resulting image can be run either by OpenShift Origin or by Docker.
These images come in two flavors, depending on your needs:
RHEL 7
CentOS 7
RHEL 7 Based Images
The RHEL 7 images are available through the Red Hat Registry:
$ docker pull registry.access.redhat.com/openshift3/nodejs-010-rhel7 $ docker pull registry.access.redhat.com/rhscl/nodejs-4-rhel7
CentOS 7 Based Image
This image is available on Docker Hub:
$ docker pull openshift/nodejs-010-centos7
To use these images, you can either access them directly from these image registries, or push them into your OpenShift Origin Docker registry. Additionally, you can create an image stream that points to the image, either in your Docker registry or at the external location. Your OpenShift Origin resources can then reference the ImageStream. You can find example image stream definitions for all the provided OpenShift Origin images.
S2I produces ready-to-run images by injecting source code into a container and letting the container prepare that source code for execution. It performs the following steps:
Starts a container from the builder image.
Downloads the application source.
Streams the scripts and application sources into the builder image container.
Runs the assemble script (from the builder image).
Saves the final image.
See S2I Build Process for a detailed overview of the build process.
The Node.js image supports a number of environment variables, which can be set to control the configuration and behavior of the Node.js runtime.
To set these environment variables as part of your image, you can place them into
a .s2i/environment file
inside your source code repository, or define them in
the environment
section of the build configuration’s sourceStrategy
definition.
You can also set environment variables to be used with an existing image when creating new applications, or by updating environment variables for existing objects such as deployment configurations.
Environment variables that control build behavior must be set as part of the s2i build configuration or in the .s2i/environment file to make them available to the build steps. |
Variable name | Description |
---|---|
|
When set to |
|
The debug port. Only valid if |
|
The custom NPM registry mirror URL. All NPM packages will be downloaded from the mirror link during the build process. |
Hot deployment allows you to quickly make and deploy changes to your application
without having to generate a new S2I build. In order to immediately pick up
changes made in your application source code, you must run your built image with
the DEV_MODE=true
environment variable.
You can set new environment variables when creating new applications, or updating environment variables for existing objects.
Only use the |
To change the source code of a running pod, open a remote shell into the container:
$ oc rsh <pod_id>
Entering into a running container changes your current directory to /opt/app-root/src, where the source code is located.