diff --git a/Jenkinsfile b/Jenkinsfile index d0d37ab..56b6cb6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -112,6 +112,12 @@ pipeline { steps { sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) { script { + // 배포 서버에서 종속성 설치 (추가된 부분) + echo "Installing production dependencies on ${env.DEPLOY_HOST}:${env.REMOTE_APP_ROOT_DIR}..." + sh "ssh ${env.DEPLOY_USER}@${env.DEPLOY_HOST} 'cd ${env.REMOTE_APP_ROOT_DIR} && npm install --production --cache ${env.REMOTE_NPM_CACHE_DIR}'" + // --production 플래그는 devDependencies를 설치하지 않아 용량을 절약합니다. + // --cache 플래그는 npm 캐시를 지정하여 다음 배포 시 속도를 높일 수 있습니다. + // PM2를 사용하여 새로운 버전의 애플리케이션을 Inactive Port에 시작 echo "Starting new version of ${env.APP_NAME} on port ${env.INACTIVE_PORT} using PM2..." @@ -128,7 +134,6 @@ pipeline { } } } - stage('Health Check New Version') { steps { sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) {