Jenkins - NodeJS Build - Docker Push
Jenkins Pipeline Item
-
Item Type (Scripted pipeline)
-
매개변수
- appName : manage-front
- BUILD_NUMBER : 1.0
-
Pipeline script
node { def nodeHome stage('Checkout') { git 'git@github.com:kalphageek/spring-cloud.git' nodeHome = tool 'NodeJS' } stage ('Install Dependencies') { sh "${nodeHome}/bin/npm install --registry http://nexus-host/repository/npm-group" } stage ('NodeJS Build') { sh "CI=false;${nodeHome}/bin/npm run build" } stage ('Docker Build') { app = docker.build("dockerhub/${env.appName}") } stage ('Docker Push') { docker.withRegistry('http://nexus-host:5001', 'dockerhub') { // (nexus repository, jenkins docker credential) app.push("${env.BUILD_NUMBER}") app.push("latest") } } }