Actualiser Jenkinsfile
This commit is contained in:
parent
5c351433d0
commit
268499048f
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
|
|
@ -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."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user