forked from nanuchi/react-nodejs-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
33 lines (29 loc) · 801 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
pipeline {
agent any
tools {
nodejs "NodeJS"
}
stages {
stage('Build Jar') {
steps {
script {
echo "Building Jar File"
sh 'npm install'
sh 'npm run build'
}
}
}
stage('Build Docker Image and Push') {
steps {
script {
echo "Building the Docker image..."
withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh 'docker build -t thejeshkumar/react-js:1.0 .'
sh "echo $PASS | docker login -u $USER --password-stdin"
sh 'docker push thejeshkumar/react-js:1.0'
}
}
}
}
}
}