Files
gameovergne-app/jenkinsfile
2025-11-20 17:45:31 +00:00

80 lines
2.1 KiB
Plaintext
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 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 dev') {
steps {
git branch: 'dev', url: 'https://gitea.unifihomenetwork.com/vincentguillet/gameovergne-app.git'
}
}
stage('Maven Build') {
steps {
dir('api') {
sh 'mvn clean package -DskipTests'
}
}
}
stage('Angular Build') {
steps {
dir('client') {
sh 'npm install'
sh 'npm run build'
}
}
}
stage('Spring Docker Build') {
steps {
sh 'docker build -t registry.unifihomenetwork.com/gameovergne-api:dev-latest ./api'
}
}
stage('Angular Docker Build') {
steps {
sh 'docker build -t registry.unifihomenetwork.com/gameovergne-client:dev-latest ./client'
}
}
stage('Spring Deployment') {
steps {
sh '''
# On supprime lancien conteneur backend sil existe
docker rm -f gameovergne-api || true
# On sassure que MySQL est lancé
docker-compose up -d mysql
# On recrée le conteneur Spring proprement
docker-compose up -d spring
'''
}
}
stage('Angular Deployment') {
steps {
sh '''
# On supprime lancien conteneur frontend sil existe
docker rm -f gameovergne-client || true
# On recrée le conteneur Angular proprement
docker-compose up -d angular
'''
}
}
}
}