I am creating a Docker image for a node.js-based application where some dependencies require an NPM token for the private NPM registry, but when creating the image, the variable containing the token is null, for example
docker build -t 3273e0bfe8dd329a96070382c1c554454ca91f96 --build-args NPM_TOKEN=null -f Dockerfile
simplified conveyor:
pipeline { environment { NPM_TOKEN = credentials('npm-token') } agent { dockerfile { additionalBuildArgs "--build-args NPM_TOKEN=${env.NPM_TOKEN}" } } stages { stage('Lint') { steps { sh 'npm run lint' } } } }
Is there a way to use the env variable in this section or is it currently not supported?
By the way, I followed the offers in Dockers and private modules related to using NPM token to create docker images
source share