Przeglądaj źródła

修改docker配置

zq940222 2 miesięcy temu
rodzic
commit
7146f6a04c
1 zmienionych plików z 12 dodań i 11 usunięć
  1. 12 11
      Jenkinsfile

+ 12 - 11
Jenkinsfile

@@ -3,13 +3,14 @@ pipeline {
 
     parameters {
         choice(name: 'ENV', choices: ['prod'], description: '部署环境')
-        choice(name: 'SERVICE', choices: ['weichi-crm-gateway', 'weichi-crm-work', 'weichi-crm-oa', 'weichi-crm-authorization', 'weichi-crm-admin', 'weichi-crm-bi', 'weichi-crm-crm', 'weichi-crm-job', 'weichi-crm-examine', 'weichi-crm-hrm'], description: '选择要部署的微服务')
+        choice(name: 'SERVICE', choices: ['gateway', 'work', 'oa', 'authorization', 'admin', 'bi', 'crm', 'job', 'examine', 'hrm'], description: '选择要部署的微服务')
     }
     environment {
         DOCKER_REGISTRY = "registry.cn-shanghai.aliyuncs.com"
         DOCKER_NAMESPACE = "advich-group"
-        DOCKER_REPO = "${params.SERVICE}"
+        DOCKER_REPO = "weichi-crm-${params.SERVICE}"
         DOCKER_IMAGE = "${DOCKER_REGISTRY}/${DOCKER_NAMESPACE}/${DOCKER_REPO}:latest"
+        PROJECT_SERVICE_COMMON_NAME = "core"
     }
 
     stages {
@@ -19,15 +20,14 @@ pipeline {
             }
         }
 
-        stage('Build') {
-            steps {
-                dir("${params.SERVICE}") {
-                    sh '''
-                        set -e
-                        mvn clean package -DskipTests
-                    '''
-                }
-            }
+        stage('公共工程打包') {
+            echo '****************************** 公共工程打包 ******************************'
+            sh "mvn -f ${PROJECT_SERVICE_COMMON_NAME} clean install -Dmaven.test.skip=true"
+        }
+
+        stage('微服务工程打包') {
+            echo '****************************** 微服务工程打包 ******************************'
+            sh "mvn -f ${params.SERVICE} clean install -Dmaven.test.skip=true"
         }
 
         stage('Build and Push Docker Image') {
@@ -39,6 +39,7 @@ pipeline {
                         passwordVariable: 'REGISTRY_PASSWORD'
                     )]) {
                         sh """
+                            cd ${params.SERVICE}
                             docker build -t ${DOCKER_IMAGE} .
                             echo "\${REGISTRY_PASSWORD}" | docker login ${DOCKER_REGISTRY} -u \${REGISTRY_USERNAME} --password-stdin
                             docker push ${DOCKER_IMAGE}