Node.js applications often require a “build step” because they are using 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
Required build step
build script must be be defined in
package.json. If an application does not require a build step, define a “no-op” build step instead.
"build": "echo 'No build step!'"
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.
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.