OpenShift Builder Images for Node.js Applications
This repository contains sources for an s2i builder image, based on CentOS7 and Node.js RPM releases from https://github.com/bucharest-gold/node-rpm. The RPMs and this builder image are the upstream
sources for the Red Hat OpenShift Application Runtimes Node.js
Node.js versions currently provided.
Using this image with OpenShift
oc command line tool, or with
s2i directly, will
assemble your application source with its required dependencies, creating a new
container image. This image contains your Node.js application and all required dependencies,
and can be run either on OpenShift or directly on Docker.
oc command-line tool can be
used to start a build, layering your desired nodejs
REPO_URL sources into a centos7
image with your selected
RELEASE of Node.js via the following command format:
oc new-app bucharestgold/centos7-s2i-nodejs:latest~https://github.com/bucharest-gold/nodejs-rest-http
With OpenShift, it is also possible to import this builder image into the
online Catalog, so that applications can be created and deployed using this Node.js
image through the web-based user interface. To import the images, run the following
oc create -f imagestreams/image-stream.yml
The Source2Image cli tools
are available as a standalone project, allowing you to run your application directly
This example will produce a new Docker image named
s2i build https://github.com/bucharest-gold/nodejs-rest-http bucharestgold/centos7-s2i-nodejs:latest webapp
Then you can run the application image like this.
docker run -p 8080:8080 --rm -it webapp
Use the following environment variables to configure the runtime behavior of the
application image created from this builder image.
|NPM_RUN||Select an alternate / custom runtime mode, defined in your
|NPM_MIRROR||Sets the npm registry URL|
|NODE_ENV||Node.js runtime mode (default: "production")|
|HTTP_PROXY||use an npm proxy during assembly|
|HTTPS_PROXY||use an npm proxy during assembly|
One way to define a set of environment variables is to include them as key value pairs
.s2i/environment file in your source repository.
NODE_ENV is set to
DEV_MODE is set to true, your Node.js application
will be started using
npx nodemon --inspect="$DEBUG_PORT"
Using Docker's exec
To change your source code in a running container, use Docker's exec command:
docker exec -it <CONTAINER_ID> /bin/bash
After you Docker exec into the running container, your current directory is set
/opt/app-root/src, where the source code for your application is located.
Using OpenShift's rsync
If you have deployed your application to OpenShift, you can use
oc rsync to copy local
files to a remote container running in an OpenShift pod.