|
|
@@ -18,27 +18,31 @@ node {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
stage('Build and Push Docker Image') {
|
|
|
- withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'admin', passwordVariable: 'azerty10')]) {
|
|
|
- // Définition des variables
|
|
|
- def dockerImageName = 'workflow_jenkins_1'
|
|
|
- def dockerImageTag = 'latest'
|
|
|
- def nexusUrl = 'https://nexus.foodgame.fr'
|
|
|
- def nexusRepository = 'fatboar_repo'
|
|
|
+ // Définition des variables
|
|
|
+ def dockerImageName = 'workflow_jenkins_1'
|
|
|
+ def dockerImageTag = 'latest'
|
|
|
+ def nexusUrl = 'https://nexus.foodgame.fr'
|
|
|
+ def nexusRepository = 'fatboar_repo'
|
|
|
+ def nexusUsername = 'admin'
|
|
|
+ def nexusPassword = 'azerty10'
|
|
|
|
|
|
+
|
|
|
|
|
|
- // Étape de connexion au registre Docker Nexus
|
|
|
- sh "docker login -u ${admin} -p ${azerty10} ${nexusUrl}"
|
|
|
+ // Étape de connexion au registre Docker Nexus
|
|
|
+ sh "docker login -u ${nexusUsername} -p ${nexusPassword} ${nexusUrl}"
|
|
|
|
|
|
- // Étape de balisage de l'image Docker pour le registre Nexus
|
|
|
- sh "docker tag ${dockerImageName}:${dockerImageTag} ${nexusUrl}/repository/${nexusRepository}/${dockerImageName}:${dockerImageTag}"
|
|
|
+ // Étape de balisage de l'image Docker pour le registre Nexus
|
|
|
+ sh "docker tag ${dockerImageName}:${dockerImageTag} ${nexusUrl}/repository/${nexusRepository}/${dockerImageName}:${dockerImageTag}"
|
|
|
|
|
|
- // Étape de poussée de l'image Docker vers le registre Nexus
|
|
|
- sh "docker push ${nexusUrl}/repository/${nexusRepository}/${dockerImageName}:${dockerImageTag}"
|
|
|
- }
|
|
|
+ // Étape de poussée de l'image Docker vers le registre Nexus
|
|
|
+ sh "docker push ${nexusUrl}/repository/${nexusRepository}/${dockerImageName}:${dockerImageTag}"
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
stage('Build Docker MEAN Stack(PreProduction Deployment)') {
|