86 lines
2.0 KiB
Plaintext
Executable File
86 lines
2.0 KiB
Plaintext
Executable File
pipeline {
|
|
agent any
|
|
|
|
tools {
|
|
maven 'mvn'
|
|
nodejs 'npm'
|
|
}
|
|
|
|
environment {
|
|
JAVA_HOME = '/opt/java/openjdk'
|
|
PATH = "${JAVA_HOME}/bin:${env.PATH}"
|
|
SPRING_IMAGE_NAME = 'spring-jenkins'
|
|
ANGULAR_IMAGE_NAME = 'angular-jenkins'
|
|
IMAGE_TAG = 'latest'
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout sur la branche main') {
|
|
steps {
|
|
git branch: 'main', url: 'https://gitea.unifihomenetwork.duckdns.org/HumanBooster/demo-fullstack.git'
|
|
}
|
|
}
|
|
|
|
stage('Maven Build') {
|
|
steps {
|
|
dir('demo-api') {
|
|
sh 'mvn compile'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Angular Build') {
|
|
steps {
|
|
dir('demo-client') {
|
|
sh 'npm install'
|
|
sh 'npm run build'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Maven Test') {
|
|
steps {
|
|
dir('demo-api') {
|
|
sh 'mvn test'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Spring Docker Build') {
|
|
steps {
|
|
dir('demo-api') {
|
|
sh 'docker-compose build spring'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Angular Docker Build') {
|
|
steps {
|
|
dir('demo-client') {
|
|
sh 'docker-compose build angular'
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Spring Deployment') {
|
|
steps {
|
|
sh """
|
|
docker-compose stop spring
|
|
docker-compose rm spring
|
|
docker-compose up -d --no-recreate spring
|
|
"""
|
|
}
|
|
}
|
|
|
|
stage('Angular Deployment') {
|
|
steps {
|
|
sh """
|
|
docker-compose stop angular
|
|
docker-compose rm angular
|
|
docker-compose up -d --no-recreate angular
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|