wuheng hace 2 años
padre
commit
9237f27cc3
Se han modificado 2 ficheros con 6 adiciones y 4 borrados
  1. 4 2
      Jenkinsfile
  2. 2 2
      docker-compose.yml

+ 4 - 2
Jenkinsfile

@@ -1,6 +1,9 @@
 pipeline {
     agent any
     stages {
+        environment {
+            BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
+        }
         stage('pullCode'){
             steps{
                 echo 'This is a pullCode step'
@@ -9,11 +12,10 @@ pipeline {
         }
         stage('Build') {
             steps {
-                echo env.BRANCH_NAME
                 echo 'Building..'
                 sh 'docker-compose down'
                 sh '~/tools/apache-maven-3.6.3/bin/mvn  clean install -Dmaven.test.skip=true'
-                sh 'docker build -t master:${BUILD_NUMBER} .'
+                sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
             }
         }
         stage('Test') {

+ 2 - 2
docker-compose.yml

@@ -1,6 +1,6 @@
 services:
-  post-project-api-master:
-    image: master:${BUILD_NUMBER}
+  post-project-api:
+    image: ${BRANCH_NAME}:${BUILD_NUMBER}
     ports:
       - 8180:8080
     networks: