wuheng 2 năm trước cách đây
mục cha
commit
469d156d6b
3 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 3 0
      .gitignore
  2. 4 1
      Jenkinsfile
  3. 2 2
      docker-compose.yml

+ 3 - 0
.gitignore

@@ -45,3 +45,6 @@ nbdist/
 !*/build/*.java
 !*/build/*.html
 !*/build/*.xml
+
+.vscode/
+git

+ 4 - 1
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'
@@ -12,7 +15,7 @@ pipeline {
                 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 yellow:${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-yellow:
-    image: yellow:${BUILD_NUMBER}
+  post-project-api:
+    image: ${BRANCH_NAME}:${BUILD_NUMBER}
     ports:
       - 8183:8080
     networks: