Skip to content

Commit 5e00266

Browse files
1126 initial commit
0 parents  commit 5e00266

File tree

177 files changed

+21584
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+21584
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
2+
charset = utf-8
3+
indent_size = 2
4+
indent_style = space
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_API_BASE_URL=http://localhost:8080

.github/workflows/main.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Deploy Vue App to Ubuntu Server using Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
env:
9+
SERVER_HOST: 211.117.197.184
10+
SERVER_SSH_USER: parkhaein
11+
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
12+
DOCKER_IMAGE_NAME: kanepark/vue-app
13+
14+
jobs:
15+
build-and-push-docker:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '18'
26+
27+
- name: Install dependencies
28+
run: |
29+
# 기존 node_modules와 package-lock.json 삭제
30+
rm -rf node_modules
31+
rm -f package-lock.json
32+
33+
# npm 캐시를 정리하여 충돌 방지
34+
npm cache clean --force
35+
36+
# 종속성 재설치
37+
npm install
38+
npm install vue-simple-range-slider
39+
40+
41+
- name: Build the Vue app
42+
run: npm run build
43+
44+
- name: Build Docker image
45+
run: docker build . --file Dockerfile --tag ${{ env.DOCKER_IMAGE_NAME }}:latest
46+
47+
- name: Login to Docker Hub
48+
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
49+
50+
- name: Push Docker image
51+
run: docker push ${{ env.DOCKER_IMAGE_NAME }}:latest
52+
53+
deploy-to-ubuntu-server:
54+
needs: build-and-push-docker
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Deploy to Ubuntu Server
59+
uses: appleboy/ssh-action@master
60+
with:
61+
host: ${{ env.SERVER_HOST }}
62+
username: ${{ env.SERVER_SSH_USER }}
63+
key: ${{ secrets.SSH_PRIVATE_KEY }}
64+
port: 234
65+
script: |
66+
LOG_DIR="/home/ubuntu/app-logs"
67+
mkdir -p $LOG_DIR
68+
touch $LOG_DIR/app.log
69+
70+
# sudo 명령어에 비밀번호 자동 입력
71+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker container prune -f
72+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker image prune -af
73+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker volume prune -f
74+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker system prune -af --volumes
75+
76+
# Docker 이미지 업데이트 및 컨테이너 실행
77+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker pull ${{ env.DOCKER_IMAGE_NAME }}:latest
78+
79+
# 기존 컨테이너 중지 및 삭제
80+
if [ "$(sudo docker ps -aq -f name=vue-container)" ]; then
81+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker stop vue-container
82+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker rm vue-container
83+
fi
84+
85+
# 새로운 컨테이너 실행
86+
echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker run --name vue-container -d -p 60:3000 -e TZ=Asia/Seoul \
87+
-v $LOG_DIR/app.log:/app/logs/app.log ${{ env.DOCKER_IMAGE_NAME }}:latest

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
*.tsbuildinfo

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"dbaeumer.vscode-eslint",
5+
"EditorConfig.EditorConfig"
6+
]
7+
}

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# newjeaps
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Customize configuration
10+
11+
See [Vite Configuration Reference](https://vite.dev/config/).
12+
13+
## Project Setup
14+
15+
```sh
16+
npm install
17+
```
18+
19+
### Compile and Hot-Reload for Development
20+
21+
```sh
22+
npm run dev
23+
```
24+
25+
### Compile and Minify for Production
26+
27+
```sh
28+
npm run build
29+
```
30+
31+
### Lint with [ESLint](https://eslint.org/)
32+
33+
```sh
34+
npm run lint
35+
```

dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# 빌드 단계
2+
FROM node:18 AS build-stage
3+
4+
WORKDIR /app
5+
6+
# 의존성 설치
7+
COPY package*.json ./
8+
RUN npm cache clean --force && npm install --no-optional
9+
10+
# Vue 애플리케이션 빌드
11+
COPY . .
12+
RUN npm run build
13+
14+
# 배포 단계
15+
FROM node:18 AS production-stage
16+
17+
WORKDIR /app
18+
19+
# 빌드된 파일만 복사
20+
COPY --from=build-stage /app/dist ./dist
21+
22+
# Node.js로 정적 파일 서빙
23+
RUN npm install -g serve
24+
25+
# 앱 실행
26+
CMD ["serve", "-s", "dist", "-l", "3000"]
27+
28+
# 포트번호
29+
EXPOSE 3000

eslint.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import js from '@eslint/js'
2+
import pluginVue from 'eslint-plugin-vue'
3+
4+
export default [
5+
{
6+
name: 'app/files-to-lint',
7+
files: ['**/*.{js,mjs,jsx,vue}'],
8+
},
9+
10+
{
11+
name: 'app/files-to-ignore',
12+
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
13+
},
14+
15+
js.configs.recommended,
16+
...pluginVue.configs['flat/essential'],
17+
]

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Newjeaps</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

jsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"paths": {
4+
"@/*": ["./src/*"]
5+
}
6+
},
7+
"exclude": ["node_modules", "dist"]
8+
}

0 commit comments

Comments
 (0)