I am new to Docker and Jenkins. I have to build and deploy Nest Js app in jenkins. When I run the Jenkins job I have to select the 'DEPLOY_PROFILE' which is equals to 'dev' and 'qa' as follows.
This is my Dockerfile,
FROM node:16-alpine
WORKDIR /app
ADD package.json /app/package.json
RUN npm config set registry http://registry.npmjs.org
RUN npm install
ADD . /app
EXPOSE 3000
CMD ["npm", "run", "start"]
I need to pass the 'DEPLOY_PROFILE' variable which is equals to 'dev' or 'qa' to the Dockerfile. Then final docker command should be look like npm run start:dev
or npm run start:qa
I have tried using
CMD ["npm", "run", "start", `:${DEPLOY_PROFILE}`]
and
CMD ["npm", "run", "start", `:${env.DEPLOY_PROFILE}`]
But nothing gave me the luck. Any help may highly appreciated!