Browse Source

修改docker配置

zq940222 2 months ago
parent
commit
bb397f3384
1 changed files with 18 additions and 12 deletions
  1. 18 12
      Jenkinsfile

+ 18 - 12
Jenkinsfile

@@ -69,18 +69,24 @@ pipeline {
                 expression { return params.ENV == 'prod' }
             }
             steps {
-                sshPublisher(publishers: [sshPublisherDesc(configName:'CRM(阿里云)', transfers: [sshTransfer(cleanRemote: false, excludes: '',
-                execCommand: """
-                    docker login -u wangfan@1934160439855919 -p Initial0 ${DOCKER_REGISTRY}
-                    docker pull ${DOCKER_IMAGE}
-                    docker rm -f ${DOCKER_REPO} || true
-                    docker run -d --name ${DOCKER_REPO} ${DOCKER_IMAGE}
-                """,
-                execTimeout: 120000, flatten: false, makeEmptyDirs: false,
-                noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '',
-                remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')],
-                usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose:
-                false)])
+                script {
+                    echo '****************************** 部署到服务器 ******************************'
+                    def DOCKER_REGISTRY = "${DOCKER_REGISTRY}"
+                    def DOCKER_NAMESPACE = "${DOCKER_NAMESPACE}"
+                    def DOCKER_REPO = "${DOCKER_REPO}"
+                    sshPublisher(publishers: [sshPublisherDesc(configName:'CRM(阿里云)', transfers: [sshTransfer(cleanRemote: false, excludes: '',
+                    execCommand: """
+                        docker login -u wangfan@1934160439855919 -p Initial0 ${DOCKER_REGISTRY}
+                        docker pull ${DOCKER_IMAGE}
+                        docker rm -f ${DOCKER_REPO} || true
+                        docker run -d --name ${DOCKER_REPO} ${DOCKER_IMAGE}
+                    """,
+                    execTimeout: 120000, flatten: false, makeEmptyDirs: false,
+                    noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '',
+                    remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')],
+                    usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose:
+                    false)])
+                }
             }
         }