관리자 2 сар өмнө
parent
commit
95c1a8782d
1 өөрчлөгдсөн 15 нэмэгдсэн , 22 устгасан
  1. 15 22
      Jenkinsfile

+ 15 - 22
Jenkinsfile

@@ -1,37 +1,30 @@
 pipeline {
     agent any
     environment {
-        DEPLOY_FRONTEND = 'H:\\IIS\\bitforum'
+        DEPLOY_FRONTEND = '/mnt/h/iis/bitforum'
     }
     stages {
-        stage('Frontend Build') {
+        stage('Build') {
             steps {
-                dir('Frontend') {
-                    bat 'npm ci'
-                    bat 'npm run build'
-                }
+                sh 'npm ci'
+                sh 'npm run build'
             }
         }
-        stage('Deploy Frontend') {
+        stage('Deploy') {
             steps {
-                bat 'pm2 stop bitforum-frontend || exit 0'
-                bat 'timeout /t 2 /nobreak'
-                // standalone 빌드 결과물 복사
-                bat 'robocopy Frontend\\.next\\standalone %DEPLOY_FRONTEND% /E /PURGE /XF web.config ecosystem.config.js || if %ERRORLEVEL% LEQ 7 exit 0'
-                bat 'robocopy Frontend\\.next\\static %DEPLOY_FRONTEND%\\.next\\static /E /PURGE || if %ERRORLEVEL% LEQ 7 exit 0'
-                bat 'robocopy Frontend\\public %DEPLOY_FRONTEND%\\public /E /PURGE || if %ERRORLEVEL% LEQ 7 exit 0'
-                // ecosystem.config.js로 PM2 시작
-                bat 'cd /d %DEPLOY_FRONTEND% && pm2 start ecosystem.config.js'
-                bat 'pm2 save'
+                sh 'rsync -av --delete --exclude="web.config" --exclude="ecosystem.config.js" .next/standalone/ ${DEPLOY_FRONTEND}/'
+                sh 'rsync -av --delete .next/static/ ${DEPLOY_FRONTEND}/.next/static/'
+                sh 'rsync -av --delete public/ ${DEPLOY_FRONTEND}/public/'
+            }
+        }
+        stage('Restart Frontend') {
+            steps {
+                sh 'powershell.exe -ExecutionPolicy Bypass -File /mnt/h/iis/bitforum/restart.ps1'
             }
         }
     }
     post {
-        success {
-            echo 'bitForum-frontend 배포 성공!'
-        }
-        failure {
-            echo 'bitforum-frontend 배포 실패 - 기록을 확인하세요.'
-        }
+        success { echo 'Frontend 배포 성공!' }
+        failure { echo 'Frontend 배포 실패 - 로그를 확인하세요.' }
     }
 }