Cloud API Overview > @adpt/cloud > nodejs > NodeImageBuildOptions
nodejs.NodeImageBuildOptions interface
Options controlling how the Docker image is built in nodejs.LocalNodeImage().
Signature:
export interface NodeImageBuildOptions extends DockerBuildOptions
Properties
Property | Type | Description |
---|---|---|
baseImage | NameTagString | Base Docker image used to build nodejs.LocalNodeImage(). |
buildArgs | Environment | Environment variables that should be present during docker build |
cmd | string | string[] | Default command to run in container |
nodeVersion | number | string | Node version used to build nodejs.LocalNodeImage(). |
optimizedImage | boolean | Build an image that allows for better layer caching of node_modulesCopies all package.json , yarn.lock , package-log.json , and npm-shrinkwrap.json files, then installs node_modules, then copies all the source files, and reruns install. This allows the first install of node_modules to be its own cacheable layer that does not need to be rebuilt when the source code changes, only when one of the aforementioned files changes.There are certain caveats to using this option. First, if baseImage or nodeVersion runs npm version 7 or later (nodeVersion >= 15), or you are using yarn, any lifecycle scripts you have cannot fail if the full source directory is not present. Neither yarn nor npm have a way to install node_modules, run the lifecycle scripts for dependencies, but skip these scripts for the main package. As a result, the preinstall run will run the lifecycle scripts without the full source present. It appears that npm versions prior to 7 don't run the lifecycle scripts for the main package, so this should not be an issue. Caveat emptor. |
packageManager | "npm" | "yarn" | string | Package manager to use in build steps in the generated Dockerfile that builds nodejs.LocalNodeImage(). |
runNpmScripts | string | string[] | Scripts that are defined in your package.json file that should be run during the image build. |