the-tip-top-frontend/Jenkinsfile
2025-10-30 13:45:25 +00:00

57 lines
1.1 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pipeline {
agent {
docker {
image 'node:20'
args '-v /var/run/docker.sock:/var/run/docker.sock'
}
}
environment {
APP_NAME = "the-tip-top-backend"
DEPLOY_PATH = "/srv/devops/the-tip-top"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Install dependencies') {
steps {
echo "📦 Installation des dépendances..."
sh 'npm install'
}
}
stage('Build Docker image') {
steps {
echo "🐳 Construction de limage Docker backend..."
sh 'docker build -t ${APP_NAME}:latest .'
}
}
stage('Deploy') {
steps {
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 backend réussi !"
}
failure {
echo "❌ Échec du pipeline backend."
}
}
}