8 次代码提交 6541b0fc77 ... cf9ccb664c

作者 SHA1 备注 提交日期
  yazid138 cf9ccb664c commit 1 月之前
  yazid138 071e16eb77 Merge branch 'staging' of https://009-sidali.kemdiktisaintek.go.id/appsptb/ptb-fe 1 月之前
  appsptb 4705900de6 Update 'actions/pengunjung.js' 2 月之前
  appsptb f4d379ebb3 Update 'env.js' 2 月之前
  appsptb f58a71ce0d Update 'env.js' 2 月之前
  appsptb 073def21b7 commit 2 月之前
  appsptb 75454342ed Update 'Jenkinsfile' 2 月之前
  yazid138 471cd6c937 commit 3 月之前
共有 1 个文件被更改,包括 17 次插入15 次删除
  1. 17 15
      Jenkinsfile

+ 17 - 15
Jenkinsfile

@@ -37,29 +37,31 @@ node {
     }
 	
     stage('Build Deploy '){
-            // // now you are on slave labeled with 'label'
-            // def workspace = WORKSPACE
-            // // ${workspace} will now contain an absolute path to job workspace on slave
-
-            // workspace = env.WORKSPACE
-            // // ${workspace} will still contain an absolute path to job workspace on slave
-
-            // // When using a GString at least later Jenkins versions could only handle the env.WORKSPACE variant:
-            // echo "Current workspace is ${env.WORKSPACE}"
-
-            // // the current Jenkins instances will support the short syntax, too:
-            // echo "Current workspace is $WORKSPACE"
-        docker.withTool("myDocker"){
+      docker.withTool("myDocker"){
             docker.withRegistry(registryAddress, registryCredential) {
 
-				def dockerImage = docker.build("ptb-fe:${env.BUILD_ID}")
+                def dockerImage = docker.build("ptb-fe:${env.BUILD_ID}")
 
                 /* Push the container to the custom Registry */
                 dockerImage.push()
                 dockerImage.push('latest')
+
+                def imageName = "000-dev-sidali.kemdiktisaintek.go.id/ptb-fe:latest"
+                def composeDir = '/workdir/production'
+
+                sh "docker pull ${imageName}"
+
+                sh "docker stop ptb-Frontend"
+                sh "docker rm ptb-Frontend"
+
+                sh """cd ${composeDir} && 
+                      docker-compose stop ptb-fe && 
+                      docker-compose rm -f ptb-fe && 
+                      docker-compose up -d ptb-fe"""
+
+                echo "Deploy completed successfully"
             }
         }
-
      }
   }
   catch (err) {