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 {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
|
|
@ -15,41 +20,39 @@ pipeline {
|
||||||
|
|
||||||
stage('Install dependencies') {
|
stage('Install dependencies') {
|
||||||
steps {
|
steps {
|
||||||
|
echo "📦 Installation des dépendances..."
|
||||||
sh 'npm install'
|
sh 'npm install'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build Next.js app') {
|
|
||||||
steps {
|
|
||||||
sh 'npm run build'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build Docker image') {
|
stage('Build Docker image') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t the-tip-top-frontend .'
|
echo "🐳 Construction de l’image Docker..."
|
||||||
|
sh '''
|
||||||
|
docker build -t ${APP_NAME}:latest .
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
echo "🚀 Déploiement du backend via Docker Compose..."
|
||||||
echo "🚀 Déploiement du frontend via Docker Compose..."
|
sh """
|
||||||
cd /srv/devops/the-tip-top
|
cd ${DEPLOY_PATH}
|
||||||
docker compose stop frontend || true
|
docker compose stop backend || true
|
||||||
docker compose rm -f frontend || true
|
docker compose rm -f backend || true
|
||||||
docker compose up -d --build frontend
|
docker compose up -d --build backend
|
||||||
'''
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
echo "✅ Déploiement du frontend réussi !"
|
echo "✅ Déploiement du backend réussi !"
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo "❌ Échec du pipeline Frontend"
|
echo "❌ Échec du pipeline backend."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user