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