Init Jenkinsfile
This commit is contained in:
52
Jenkinsfile
vendored
Normal file
52
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
DEPLOY_DIR = '/var/www/portfolio'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install') {
|
||||
steps {
|
||||
sh 'npm install'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'npm run build'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
sh '''
|
||||
rm -rf ${DEPLOY_DIR}/*
|
||||
cp -r .next ${DEPLOY_DIR}/
|
||||
cp -r public ${DEPLOY_DIR}/ 2>/dev/null || true
|
||||
cp package.json ${DEPLOY_DIR}/
|
||||
cp -r node_modules ${DEPLOY_DIR}/
|
||||
cd ${DEPLOY_DIR}
|
||||
pm2 delete portfolio || true
|
||||
pm2 start npm --name portfolio -- start -- -p 3333
|
||||
pm2 save
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo '✅ Portfolio deployed!'
|
||||
}
|
||||
failure {
|
||||
echo '❌ Deploy fehlgeschlagen!'
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user