Remove NodeJS reference for Windows Minikube pipeline

This commit is contained in:
VIPIN 2025-09-09 22:33:34 +05:30
parent ecd840b0c8
commit 6124329708

96
Jenkinsfile vendored
View File

@ -1,86 +1,24 @@
pipeline {
agent any
agent any
tools {
environment {
DOCKERHUB_REPO = "vipin2025devops/myapp"
IMAGE_TAG = "${env.BUILD_NUMBER}"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
environment {
WEB_IP = '13.49.223.142' // EC2 web server IP
SSH_USER = 'deploy' // Deploy user
SSH_KEY_PATH = '/home/ubuntu/.ssh/jenkins-deploy' // Path to private key on Jenkins server
NODE_OPTIONS = "--max_old_space_size=512"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Install') {
steps {
sh '''
echo "📦 Installing dependencies..."
npm ci
'''
}
}
stage('Build') {
steps {
sh '''
echo "🏗️ Building project..."
npm run build
'''
}
}
stage('Package') {
steps {
sh '''
OUT_DIR="build"
[ -d dist ] && OUT_DIR="dist"
if [ ! -d "$OUT_DIR" ]; then
echo "❌ ERROR: No build output found (build/ or dist/)"
ls -la
exit 1
fi
echo "📦 Packaging build output..."
tar -czf build.tar.gz -C "$OUT_DIR" .
'''
archiveArtifacts artifacts: 'build.tar.gz'
}
}
stage('Deploy') {
steps {
script {
sh """
echo "🚀 Deploying to ${WEB_IP}..."
# Copy build to remote server
scp -i ${SSH_KEY_PATH} -o StrictHostKeyChecking=no build.tar.gz ${SSH_USER}@${WEB_IP}:/tmp/build.tar.gz
# Deploy remotely
ssh -i ${SSH_KEY_PATH} -o StrictHostKeyChecking=no ${SSH_USER}@${WEB_IP} '
mkdir -p ~/reactapp
rm -rf ~/reactapp/*
tar -xzf /tmp/build.tar.gz -C ~/reactapp
'
echo "✅ Deployment finished"
"""
}
}
}
}
post {
success { echo "✅ Pipeline completed successfully" }
failure { echo "❌ Pipeline failed — check console log" }
// Build, push, deploy stages...
}
post {
always {
echo "Pipeline finished: ${currentBuild.fullDisplayName}"
}
}
}