Vite + Vue 사용 안함

4454 단어 jayeonjayeon

📗Vite + Vue 3.0

Vite와 Vue로 프로젝트를 생성하자

npm init vite-app <project name>

그 이후

npm install
npm run dev

명령어로 실행을 확인하자

화면을 확인했으니 실서버에 올려보자!

🐋Dockerfile 작성 후 hub 올리기

FROM node:slim

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . /app

CMD [ "npm", "run", "dev"]

Dockerfile

node_modules
package-lock.json

.dockerignore파일을 작성한 후

docker build -t ililil9482/jayeon-vue:1.0 .
docker push ililil9482/jayeon-vue:1.0

hub에 푸시했다.

✅Nginx 수정

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    server {
        listen 80;
	    server_name jayeonapple.com;

        location / {
            proxy_pass http://jayeon:3000;
        }
    }
    
    server {
        listen 80;
	    server_name juno.jayeonapple.com;

        location / {
            proxy_pass http://portfolio:3000;
        }
    }

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    #include /etc/nginx/conf.d/*.conf;
}

nginx.conf 파일을 다음과 같이 수정한다.

nginx 이미지를 다시 build 후 컨테이너를 종료 후 다시 실행하자!

🤵‍♂️jenkins 설정 변경

pipeline {
    agent any

    stages {
        stage('Down') {
            steps {
sshPublisher(publishers: [
  sshPublisherDesc(configName: 'aws',
  transfers: [
    sshTransfer(cleanRemote: false,
    excludes: '',
    execCommand: 'cd /project/jayeon && sudo docker-compose down',
    execTimeout: 120000,
    flatten: false,
    makeEmptyDirs: false,
    noDefaultExcludes: false,
    patternSeparator: '[, ]+',
    remoteDirectory: '',
    remoteDirectorySDF: false,
    removePrefix: '',
    sourceFiles: '')
  ],
  usePromotionTimestamp: false,
  useWorkspaceInPromotion: false,
  verbose: false)
])
            }
        }

        stage('Pull') {
            steps {
sshPublisher(publishers: [
  sshPublisherDesc(configName: 'aws',
  transfers: [
    sshTransfer(cleanRemote: false,
    excludes: '',
    execCommand: 'sudo docker pull ililil9482/jayeon-vue:1.0',
    execTimeout: 120000,
    flatten: false,
    makeEmptyDirs: false,
    noDefaultExcludes: false,
    patternSeparator: '[, ]+',
    remoteDirectory: '',
    remoteDirectorySDF: false,
    removePrefix: '',
    sourceFiles: '')
  ],
  usePromotionTimestamp: false,
  useWorkspaceInPromotion: false,
  verbose: false)
])
            }
        }

        stage('Up') {
            steps {
sshPublisher(publishers: [
  sshPublisherDesc(configName: 'aws',
  transfers: [
    sshTransfer(cleanRemote: false,
    excludes: '',
    execCommand: 'cd /project/jayeon && sudo docker-compose up -d',
    execTimeout: 120000,
    flatten: false,
    makeEmptyDirs: false,
    noDefaultExcludes: false,
    patternSeparator: '[, ]+',
    remoteDirectory: '',
    remoteDirectorySDF: false,
    removePrefix: '',
    sourceFiles: '')
  ],
  usePromotionTimestamp: false,
  useWorkspaceInPromotion: false,
  verbose: false)
])
            }
        }
        
        
    }
}

http://jayeonapple.com/

http://juno.jayeonapple.com/

모두 잘 연결된 것을 확인했다.

좋은 웹페이지 즐겨찾기