Building Node.js applications
Node.js applications often require a “build step” because they use a syntax or feature that is not natively supported by Node.js. Applications may also use a build step to prefetch data, pre-render HTML, compile or minify static assets, or similar preparatory work that must be performed before the application can be started.
When code is pushed to a Node.js application’s deploying branch, the VIP Platform infrastructure automatically pulls the code, installs the dependencies, and runs the build step:npm run build
The status and logs for each build can be reviewed in the Deployments panel of the VIP Dashboard.
Required build step
A build
script must be defined in package.json
. If an application does not require a build step, define a “no-op” build step instead.
For example:"build": "echo 'No build step!'"
Build environment
The build step runs once per deployment and the result (often called the “build artifact”) is reused across all environment containers. Reproducible (deterministic) builds are strongly recommended to aid in debugging and troubleshooting across environments.
The environment’s working directory is writable during the build step and any created directories or files will be part of the build artifact. Once an environment container starts, however, the file system is read-only.
Environment variables that are set for an environment are available during the build step.
Alternative approaches
The build environment is standard across all VIP applications. VIP cannot install specific packages or software, or otherwise, customize the environment.
If an application’s build process is not suited to run on VIP’s infrastructure, it may be preferable to use an external CI/CD service. This method enables a build artifact to be committed and pushed to a deploy branch and requires a “no-op” build step to be defined so that the build does not run again on VIP’s infrastructure.
Last updated: August 08, 2024