chore: remove Jenkinsfile
This commit is contained in:
56
jenkinsfile
56
jenkinsfile
@@ -1,56 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
// Assurez-vous d'avoir configuré l'outil "NodeJS 20" dans Jenkins (Global Tool Configuration)
|
|
||||||
tools {
|
|
||||||
nodejs 'NodeJS 20'
|
|
||||||
}
|
|
||||||
|
|
||||||
environment {
|
|
||||||
// Variables pour éviter de répéter les chemins
|
|
||||||
FRONT_DEST = '/var/www/xeewy.be'
|
|
||||||
BACK_DEST = '/var/www/xeewy/backend'
|
|
||||||
SERVICE_NAME = 'xeewy-backend'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
stage('Build Frontend') {
|
|
||||||
steps {
|
|
||||||
echo '--- Building React Frontend ---'
|
|
||||||
dir('frontend') {
|
|
||||||
sh 'npm install'
|
|
||||||
sh 'npm run build'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Deploy Frontend') {
|
|
||||||
steps {
|
|
||||||
echo '--- Deploying Frontend to Apache folder ---'
|
|
||||||
sh "rm -rf ${FRONT_DEST}/*"
|
|
||||||
sh "cp -r frontend/build/* ${FRONT_DEST}/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Deploy Backend') {
|
|
||||||
steps {
|
|
||||||
echo '--- Deploying Backend Code ---'
|
|
||||||
// On copie le code backend vers sa destination
|
|
||||||
// On exclut node_modules pour éviter de copier des milliers de fichiers inutilement
|
|
||||||
sh "rsync -av --exclude='node_modules' backend/ ${BACK_DEST}/"
|
|
||||||
|
|
||||||
dir("${BACK_DEST}") {
|
|
||||||
sh 'npm install --production'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Restart Service') {
|
|
||||||
steps {
|
|
||||||
echo '--- Restarting Node.js Service ---'
|
|
||||||
// Nécessite la règle sudo NOPASSWD configurée précédemment
|
|
||||||
sh "sudo systemctl restart ${SERVICE_NAME}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user