Update Jenkinsfile: use npm install instead of npm ci

This commit is contained in:
VIPIN 2025-08-28 15:51:16 +05:30
parent 4d4e33284b
commit e939fe1353

25
Jenkinsfile vendored
View File

@ -1,14 +1,29 @@
pipeline { pipeline {
agent any agent any
tools { nodejs 'Node' } tools { nodejs 'Node' } // make sure in Jenkins -> Global Tool Config -> NodeJS is named "Node"
environment { environment {
WEB_IP = '13.49.223.142' // your EC2 web server IP WEB_IP = '13.49.223.142' // your EC2 web server IP
SSH_CRED = 'deploy-ec2-key' // Jenkins credential ID for SSH key SSH_CRED = 'deploy-ec2-key' // Jenkins credential ID for SSH key
} }
stages { stages {
stage('Checkout') { steps { checkout scm } } stage('Checkout') {
stage('Install') { steps { sh 'npm ci || npm install' } } steps {
stage('Build') { steps { sh 'npm run build' } } checkout scm
}
}
stage('Install') {
steps {
sh 'npm install' //
}
}
stage('Build') {
steps {
sh 'npm run build'
}
}
stage('Package') { stage('Package') {
steps { steps {
sh ''' sh '''
@ -24,6 +39,7 @@ pipeline {
archiveArtifacts artifacts: 'build.tar.gz' archiveArtifacts artifacts: 'build.tar.gz'
} }
} }
stage('Deploy') { stage('Deploy') {
steps { steps {
sshagent(credentials: [env.SSH_CRED]) { sshagent(credentials: [env.SSH_CRED]) {
@ -40,6 +56,7 @@ pipeline {
} }
} }
} }
post { post {
success { echo "✅ Deployed successfully" } success { echo "✅ Deployed successfully" }
failure { echo "❌ Failed — check console" } failure { echo "❌ Failed — check console" }