From 63f22e253812eacd28ec045d523632fc14c28886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Wed, 25 Feb 2026 10:18:53 +0900 Subject: [PATCH] =?UTF-8?q?fix:Jenkinsfile=20=ED=99=98=EA=B2=BD=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=9D=84=20.env.local=EC=97=90=EC=84=9C=20.env.produc?= =?UTF-8?q?tion=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Next.js 우선순위 문제 해결 (.env.local이 .env.production을 덮어쓰는 문제) - Prepare Env, Deploy Development/Stage/Production, Rebuild 5곳 수정 --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0e2e182..3bc780df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,10 +20,10 @@ pipeline { script { if (env.BRANCH_NAME == 'main') { // main: Stage 빌드 먼저 (승인 후 Production 재빌드) - sh "cp /var/lib/jenkins/env-files/react/.env.stage .env.local" + sh "cp /var/lib/jenkins/env-files/react/.env.stage .env.production" } else { def envFile = "/var/lib/jenkins/env-files/react/.env.${env.BRANCH_NAME}" - sh "cp ${envFile} .env.local" + sh "cp ${envFile} .env.production" } } } @@ -47,7 +47,7 @@ pipeline { --exclude='.git' --exclude='.env*' --exclude='ecosystem.config.*' \ .next package.json next.config.ts public node_modules \ ${DEPLOY_USER}@114.203.209.83:/home/webservice/react/ - scp .env.local ${DEPLOY_USER}@114.203.209.83:/home/webservice/react/.env.local + scp .env.production ${DEPLOY_USER}@114.203.209.83:/home/webservice/react/.env.production ssh ${DEPLOY_USER}@114.203.209.83 'cd /home/webservice/react && pm2 restart sam-react' """ } @@ -64,7 +64,7 @@ pipeline { rsync -az --delete \ .next package.json next.config.ts public node_modules \ ${DEPLOY_USER}@211.117.60.189:/home/webservice/react-stage/releases/${RELEASE_ID}/ - scp .env.local ${DEPLOY_USER}@211.117.60.189:/home/webservice/react-stage/releases/${RELEASE_ID}/.env.local + scp .env.production ${DEPLOY_USER}@211.117.60.189:/home/webservice/react-stage/releases/${RELEASE_ID}/.env.production ssh ${DEPLOY_USER}@211.117.60.189 ' ln -sfn /home/webservice/react-stage/releases/${RELEASE_ID} /home/webservice/react-stage/current && cd /home/webservice && pm2 reload sam-front-stage 2>/dev/null || pm2 start react-stage/current/node_modules/.bin/next --name sam-front-stage -- start -p 3100 && @@ -90,7 +90,7 @@ pipeline { stage('Rebuild for Production') { when { branch 'main' } steps { - sh "cp /var/lib/jenkins/env-files/react/.env.main .env.local" + sh "cp /var/lib/jenkins/env-files/react/.env.main .env.production" sh 'npm run build' } } @@ -105,7 +105,7 @@ pipeline { rsync -az --delete \ .next package.json next.config.ts public node_modules \ ${DEPLOY_USER}@211.117.60.189:/home/webservice/react/releases/${RELEASE_ID}/ - scp .env.local ${DEPLOY_USER}@211.117.60.189:/home/webservice/react/releases/${RELEASE_ID}/.env.local + scp .env.production ${DEPLOY_USER}@211.117.60.189:/home/webservice/react/releases/${RELEASE_ID}/.env.production ssh ${DEPLOY_USER}@211.117.60.189 ' ln -sfn /home/webservice/react/releases/${RELEASE_ID} /home/webservice/react/current && cd /home/webservice && pm2 reload sam-front &&