diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..a493b60 --- /dev/null +++ b/Jenkinsfile @@ -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!' + } + } +} \ No newline at end of file