From 268499048fbcdf1459b9815be49154004640faf6 Mon Sep 17 00:00:00 2001 From: wkadmin Date: Thu, 30 Oct 2025 13:40:38 +0000 Subject: [PATCH] Actualiser Jenkinsfile --- Jenkinsfile | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 614c556..8495534 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,6 +6,11 @@ pipeline { } } + environment { + APP_NAME = "the-tip-top-backend" + DEPLOY_PATH = "/srv/devops/the-tip-top" + } + stages { stage('Checkout') { steps { @@ -15,41 +20,39 @@ pipeline { stage('Install dependencies') { steps { + echo "📦 Installation des dépendances..." sh 'npm install' } } - stage('Build Next.js app') { - steps { - sh 'npm run build' - } - } - stage('Build Docker image') { steps { - sh 'docker build -t the-tip-top-frontend .' + echo "🐳 Construction de l’image Docker..." + sh ''' + docker build -t ${APP_NAME}:latest . + ''' } } stage('Deploy') { steps { - sh ''' - echo "🚀 Déploiement du frontend via Docker Compose..." - cd /srv/devops/the-tip-top - docker compose stop frontend || true - docker compose rm -f frontend || true - docker compose up -d --build frontend - ''' + echo "🚀 Déploiement du backend via Docker Compose..." + sh """ + cd ${DEPLOY_PATH} + docker compose stop backend || true + docker compose rm -f backend || true + docker compose up -d --build backend + """ } } } post { success { - echo "✅ Déploiement du frontend réussi !" + echo "✅ Déploiement du backend réussi !" } failure { - echo "❌ Échec du pipeline Frontend" + echo "❌ Échec du pipeline backend." } } }