NodeJS Build Container
IMPORTANT: These images are not intended for use on production systems and are only approved for use with build pipelines. They are specifically optimised for our build environments and may have unintended consequences if used anywhere else
This image is intended to streamline the build of javascript applications that utilise npm & yarn in a nodejs compatible environment.
Ubuntu Base
This image utilises an ubuntu Base in order to take advantage of the prebuilt Node binaries that are not compatible with the Alpine/Musl base NVM
NVM
To install and manage Node we use the Node Version Manager (NVM). This allows us to easily install node and its includes both npm & npx in its installation. By default it relies on the NODE_VERSION environment variable, which can be set as a container build arg, in order to know what version of node to install when building the container.
It also relies on the NVM_DIR variable for the default location to install nvm and its versions of node.
Entrypoint.sh
Script | DESCRIPTION |
---|---|
npm-registry.sh | configured the environment to utilise an appropriate npm compatible registry, it will attempt to aithenticate with the following registres: AWS CodeArtifacts, Azure Artifacts, Private Registry (Verdaccio), npm.js |
Profile.d
Script | DESCRIPTION |
---|---|
nvm.sh | ensures that NVM and all installed tools are available on the $PATH |
Environment Variables
As well as the variables in the base this container also introduces the following variables
Name | DEFAULT VALUE | DESCRIPTION |
---|---|---|
NODE_VERSION | 20 |
what version of Node has been installed on the container. Changing this will not change the version of node |
NVM_DIR | /usr/local/nvm |
the location that NVM is installed |
AWS_ARTIFACTS | unset | set to 'enabled' to utilise the Builder AWS CodeArtifacst registry |
AWS_ARTIFACTS_KEY | unset | an AWS_ACCESS_KEY_ID that must be provided to authenticate with AWS CodeArtifacts |
AWS_ARTIFACTS_SECRET | unset | an AWS_ACCESS_KEY_SECRET that must be provided to authenticate with AWS CodeArtifacts |
AZURE_ARTIFACTS | unset | the name of the AzureArtifacts organisation to use |
AZURE_ARTIFACTS_TOKEN | unset | a Personal Access token to authenticate with AzureArtifacts |
NPM_CACHE_REGISTRY_HOST | unset | the host for a npm compatible proxy such as verdacccio |
NPM_AUTH_TOKEN | unset | the token for an npm compatible proxy such as Verdaccio |