This repository contains sources of the images for building various versions of NodeJS applications as reproducible Docker images using source-to-image. User can choose between RHEL and CentOS based builder images. The resulting image can be run using Docker.
NodeJS versions currently provided are:
- nodejs-0.10
RHEL versions currently supported are:
- RHEL7
CentOS versions currently supported are:
- CentOS7
To build NodeJS image, choose between CentOS or RHEL based image:
-
RHEL based image
To build a rhel-based nodejs-0.10 image, you need to run the build on a properly subscribed RHEL machine.
$ git clone https://github.com/openshift/sti-nodejs.git $ cd sti-nodejs $ make build TARGET=rhel7 VERSION=0.10
-
CentOS based image
This image is available on DockerHub. To download it use:
$ docker pull openshift/nodejs-010-centos7
To build NodeJS image from scratch use:
$ git clone https://github.com/openshift/sti-nodejs.git $ cd sti-nodejs $ make build VERSION=0.10
Notice: By omitting the VERSION
parameter, the build/test action will be performed
on all provided versions of NodeJS. Since we are now providing only version 0.10
,
you can omit this parameter.
To build simple nodejs-sample-app application, using standalone STI and then run the resulting image with Docker execute:
-
For RHEL based image
$ sti build https://github.com/openshift/sti-nodejs.git --context-dir=0.10/test/test-app/ openshift/nodejs-010-rhel7 nodejs-sample-app $ docker run -p 8080:8080 nodejs-sample-app
-
For CentOS based image
$ sti build https://github.com/openshift/sti-nodejs.git --context-dir=0.10/test/test-app/ openshift/nodejs-010-centos7 nodejs-sample-app $ docker run -p 8080:8080 nodejs-sample-app
Accessing the application:
$ curl 127.0.0.1:8080
This repository also provides STI test framework, which launches tests to check functionality of a simple nodejs application built on top of sti-nodejs image.
User can choose between testing nodejs test application based on RHEL or CentOS image.
-
RHEL based image
To test a rhel7-based nodejs-0.10 image, you need to run the test on a properly subscribed RHEL machine.
$ cd sti-nodejs $ make test TARGET=rhel7 VERSION=0.10
-
CentOS based image
$ cd sti-nodejs $ make test VERSION=0.10
Notice: By omitting the VERSION
parameter, the build/test action will be performed
on all provided versions of NodeJS. Since we are now providing only version 0.10
you can omit this parameter.
-
<nodejs-version>
-
Dockerfile
CentOS based Dockerfile.
-
Dockerfile.rhel7
RHEL based Dockerfile. In order to perform build or test actions on this Dockerfile you need to run the action on a properly subscribed RHEL machine.
-
.sti/bin/
This folder contains scripts that are run by STI:
-
assemble
Is used to install the sources into location from where the application will be run and prepare the application for deployment (eg. installing modules using npm, etc.)
-
run
This script is responsible for running the application, by using the application web server.
-
usage*
This script prints the usage of this image.
-
-
contrib/
This folder contains file with commonly used modules.
-
test/
This folder is containing STI test framework with simple node.js echo server.
-
-
hack/
Folder contains scripts which are responsible for build and test actions performed by the
Makefile
.
- Platform name - nodejs
- Platform version(without dots)
- Base builder image - centos7/rhel7
Examples: openshift/nodejs-010-centos7
, openshift/nodejs-010-rhel7