package.json

"scripts": {
    "build": "nuxt build",
    "generate": "nuxt generate --dotenv config/.env.prod",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "local": "nuxt dev --dotenv config/.env.local --port 3000",
    "dev": "nuxt dev --dotenv config/.env.dev --port 3001",
    "stage": "nuxt stage --dotenv config/.env.stage",
    "prod": "nuxt prod --dotenv config/.env.prod --port 80"
  },

nuxt.config.ts

app: {
        head: {
            charset: 'utf-8',
            viewport: 'width=device-width, initial-scale=1.0',
            title: '',
            meta: [
                {name: 'X-UA-Compatible', content: 'IE=edge'},
            ]
        },
        baseURL: process.env.CONTEXT_URI ?? "/mysite",     
    },

config/.env.{profile}

#API 호출 기본 URL
API_SERVER_URI=http://apiurl/api
#쿠키에 담기는 토근 정보 key명칭
#실행 모드(consol 로그 기록 등이 달라진다.)
MODE=dev
#개발서버(test.micropolis.co.kr)를 위한 속성값
CONTEXT_URI=/mysite/

jenkins> New Item> Freestyle project> 

Git

   Repository URL> http://~/~.git

   Branches to build> */{profile}

Build Steps

   Execute Windows batch command

      cmd /c d:\~\deploy.bat

 

deploy.bat (case npm 실행 방식 : dev)

   최초 소스 npm run dev 이후

   call npx kill-port {profileport}
   SET JENKINS_WORK=%WORKSPACE%
   SET MYSITE_HOME=D:\~\~
   call npm install
   call xcopy "%JENKINS_WORK%\*" "%MYSITE_HOME%\*" /e /k /y

 

deploy.bat (static site 방식 : prod)

   SET JENKINS_WORK=%WORKSPACE%
   SET MYSITE_HOME=D:\~\mysite
   call npm install

   npm run generate
   call xcopy "%JENKINS_WORK%\.output\public\*" "%MYSITE_HOME%\*" /e /k /y

 

deploy.bat (static site 방식 : prod) > weblogic

nginx.conf

   http > server > 

      listen 80

      server_name localhost

      location / {

         root html;

         index index.html index.htm;

      }

      location ~/mysite {

         root "D:/~/ews-ui";

         index index.html;

      }

 

nginx -s reload

 

http://~/mysite

at nuxt.config.ts

   app.baseURL: '<basePath>' or process.env.basePathVariable

 

in vue page

  useNuxtApp().$config.app.baseURL

'Dev-Vue.js' 카테고리의 다른 글

pm2 vuejs nuxt3 jenkins 무중단 배포  (0) 2023.09.12
vue3 nuxt3 jenkins nginx windows 배포  (0) 2023.09.08

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols
New > Key > TLS 1.0 > Client > DWORD (32) Enable Hexadecimal 0
                                                        DisabledByDefault 1

New > Key > TLS 1.0 > Server > DWORD (32) Enable Hexadecimal 0
                                                        DisabledByDefault 1

+ Recent posts