Add installation of production dependencies on deployment server
Some checks failed
main-branch-frovide/pipeline/head There was a failure building this commit

This commit is contained in:
Insub Kim 2025-06-06 21:34:53 +09:00
parent 62836f7769
commit 40f64cfed1

7
Jenkinsfile vendored
View File

@ -112,6 +112,12 @@ pipeline {
steps { steps {
sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) { sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) {
script { 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에 시작 // PM2를 사용하여 새로운 버전의 애플리케이션을 Inactive Port에 시작
echo "Starting new version of ${env.APP_NAME} on port ${env.INACTIVE_PORT} using PM2..." 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') { stage('Health Check New Version') {
steps { steps {
sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) { sshagent(credentials: [env.JENKINS_SSH_CREDENTIAL_ID]) {