183 lines
3.6 KiB
Groff
183 lines
3.6 KiB
Groff
.TH "nodejs" "1" "" "Rado Pitonak \<rpitonak@redhat.com\>" "DATE 07.04.2017" ""
|
|
|
|
|
|
.SH NAME
|
|
.PP
|
|
nodejs \- source to image builder of node.js applications.
|
|
|
|
|
|
.SH DESCRIPTION
|
|
.PP
|
|
Image for building node.js application as reproducible Docker image using source to image.Image is based on fedora.
|
|
|
|
|
|
.SH USAGE
|
|
.PP
|
|
To pull the nodejs container run:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker pull rpitonak/nodejs:6
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
To build your node.js application use run:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# s2i build <SOURCE\-REPOSITORY> nodejs:6 <NAME\-OF\-APP>
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
To run your application in docker container:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker run \-d \-p 8080:8080 <NAME\-OF\-APP>
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
By default container is running in production mode with exposed port 8080.To change behavior see Enviroment variables section below.
|
|
|
|
|
|
.SH ENVIRONMENT VARIABLES
|
|
.PP
|
|
NODE\_ENV=runtime\_mode
|
|
Node.js runtime mode (default: "production")
|
|
|
|
.PP
|
|
DEV\_MODE=mode
|
|
When set to "true", \fB\fCnodemon\fR will be used to automatically reload the server while you work (default: "false"). Setting \fB\fCDEV\_MODE\fR to "true" will change the \fB\fCNODE\_ENV\fR default to "development" (if not explicitly set).
|
|
|
|
.PP
|
|
NPM\_RUN=value
|
|
Select an alternate / custom runtime mode, defined in your \fB\fCpackage.json\fR file's
|
|
\[la]https://docs.npmjs.com/misc/scripts\[ra] section (default: npm run "start"). These user\-defined run\-scripts are unavailable while \fB\fCDEV\_MODE\fR is in use.
|
|
|
|
.PP
|
|
HTTP\_PROXY=url
|
|
Use an npm proxy during assembly
|
|
|
|
.PP
|
|
HTTPS\_PROXY=url
|
|
Use an npm proxy during assembly
|
|
|
|
.PP
|
|
NPM\_MIRROR=registry
|
|
Use a custom NPM registry mirror to download packages during the build process
|
|
|
|
|
|
.SH DEVELOPMENT
|
|
.PP
|
|
This image supports development mode. This mode can be switched on and off with the environment variable \fB\fCDEV\_MODE\fR. \fB\fCDEV\_MODE\fR can either be set to \fB\fCtrue\fR or \fB\fCfalse\fR.
|
|
The debug port can be specified with the environment variable \fB\fCDEBUG\_PORT\fR. \fB\fCDEBUG\_PORT\fR is only valid if \fB\fCDEV\_MODE=true\fR.
|
|
By default, \fB\fCDEV\_MODE\fR is set to \fB\fCfalse\fR, and \fB\fCDEBUG\_PORT\fR is set to \fB\fC5858\fR, however the \fB\fCDEBUG\_PORT\fR is only relevant if \fB\fCDEV\_MODE=true\fR.
|
|
|
|
|
|
.SH HOT DEPLOY
|
|
.PP
|
|
As part of development mode, this image supports hot deploy. If development mode is enabled, any souce code that is changed in the running container will be immediately reflected in the running nodejs application
|
|
|
|
.PP
|
|
To change your source code in a running container, use Docker's exec (
|
|
\[la]https://docs.docker.com/engine/reference/commandline/exec/\[ra]) command:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker exec \-it <CONTAINER\_ID> /bin/bash
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
After you enter into the running container, your current directory is set to /opt/app\-root/, where the source code is located.
|
|
|
|
|
|
.SH EXAMPLE
|
|
.PP
|
|
To run your application in development mode run:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker run \-\-env DEV\_MODE=true \-p 8080:8080 <NAME\-OF\-APP>
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
To run the container in production mode, run:
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker run \-\-env DEV\_MODE=false <NAME\-OF\-APP>
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
To run the container in development mode with a debug port of 5454, run
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# docker run \-\-env DEV\_MODE=true DEBUG\_PORT=5454 <NAME\-OF\-APP>
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
To build your application with using of npm proxy.
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
# s2i build ./test/test\-app nodejs:6 my\-app \-\-env HTTP\_PROXY=url
|
|
|
|
.fi
|
|
.RE
|
|
|
|
|
|
.SH SECURITY IMPLICATIONS
|
|
.PP
|
|
\-d
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
Runs continuously as a daemon process in the background
|
|
|
|
.fi
|
|
.RE
|
|
|
|
.PP
|
|
\-p 8080:8080
|
|
|
|
.PP
|
|
.RS
|
|
|
|
.nf
|
|
Opens container port 8080 and maps it to the same port on the Host.
|
|
|
|
.fi
|
|
.RE
|