Skip to content

Commit 447a81c

Browse files
authored
[UNI-30] 어드민 페이지 개발 (#37)
* [UNI-30] feat: admin page 초기 세팅 / 초기 CSS 설정 * [UNI-30] feat : tailwind css 적용 및 테스트 * [UNI-30] feat : 기본적인 화면 Layout 생성 * [UNI-30] feat : 기본적인 Layout 작성 및 Container 분할 * [UNI-30] feat : DropDown 개발, DropDown 선택에 따라 지도 위치 변경 * [UNI-101] feat : admin deploy 설정 완료 * [UNI-101] fix : sh 문법 오류 수정 * [UNI-101] fix : 종료 docker 수정 * [UNI-101] fix : docker network 분리 * [UNI-101] fix : application port 수정 * [UNI-101] feat : 빌드 경로 변경 * [UNI-101] fix : fe 브랜치에서만 deploy 되도록 변경 * [UNI-30] feat: LogList 컴포넌트화 * [UNI-30] fix : Mock Data 분리
1 parent 0301f1b commit 447a81c

Some content is hidden

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

44 files changed

+7176
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/.DS_Store

6 KB
Binary file not shown.

.github/workflows/fe-admin-deploy.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: FE ADMIN CI / CD
2+
3+
on:
4+
push:
5+
branches:
6+
- fe
7+
8+
jobs:
9+
CI:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
14+
IMAGE_NAME: uniro-backoffice
15+
IMAGE_TAG: ${{ github.sha }}
16+
17+
steps:
18+
- name: 코드 체크아웃
19+
uses: actions/checkout@v4
20+
21+
- name: Google Cloud SDK 설정
22+
uses: "google-github-actions/auth@v2"
23+
with:
24+
credentials_json: ${{ secrets.GCP_SA_KEY }}
25+
26+
- name: Docker를 위한 gcloud 인증 설정
27+
run: gcloud auth configure-docker --quiet
28+
29+
- name: Create .env from secret
30+
run: |
31+
echo "${{ secrets.FE_ENV }}" > uniro_admin_frontend/.env
32+
33+
- name: Docker 이미지 빌드 및 푸시
34+
run: |
35+
docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_admin_frontend/Dockerfile .
36+
docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
37+
38+
CD:
39+
runs-on: ubuntu-latest
40+
needs: CI
41+
42+
env:
43+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
44+
IMAGE_NAME: uniro-backoffice
45+
IMAGE_TAG: ${{ github.sha }}
46+
DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }}
47+
48+
steps:
49+
- name: 배포 서버에 SSH로 연결하여 배포
50+
uses: appleboy/[email protected]
51+
with:
52+
host: ${{ secrets.DEPLOY_SERVER_HOST }}
53+
username: ${{ secrets.DEPLOY_SERVER_USER }}
54+
key: ${{ secrets.DEPLOY_SSH_KEY }}
55+
envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST
56+
script: |
57+
cd ${DEPLOY_PATH}
58+
sudo docker ps -a --format '{{.ID}} {{.Names}}' \
59+
| egrep -v 'nginx-container|uniro-fe' \
60+
| awk '{print $1}' \
61+
| xargs -r sudo docker stop || true
62+
sudo docker rm $(sudo docker ps -a -q) || true
63+
sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}'
64+
sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
65+
sudo docker run -d --name ${IMAGE_NAME} -p 3001:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}

uniro_admin_frontend/.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
26+
.env

uniro_admin_frontend/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:22-slim AS build
2+
3+
WORKDIR /app
4+
COPY ./uniro_admin_frontend .
5+
6+
RUN npm install --legacy-peer-deps --no-audit && npm run build
7+
8+
FROM nginx
9+
10+
COPY uniro_admin_frontend/nginx/nginx.conf /etc/nginx/nginx.conf
11+
COPY --from=build /app/dist /usr/share/nginx/html
12+
13+
EXPOSE 3000
14+
15+
CMD ["nginx", "-g", "daemon off;"]

uniro_admin_frontend/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## Expanding the ESLint configuration
11+
12+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13+
14+
- Configure the top-level `parserOptions` property like this:
15+
16+
```js
17+
export default tseslint.config({
18+
languageOptions: {
19+
// other options...
20+
parserOptions: {
21+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
22+
tsconfigRootDir: import.meta.dirname,
23+
},
24+
},
25+
})
26+
```
27+
28+
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29+
- Optionally add `...tseslint.configs.stylisticTypeChecked`
30+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
31+
32+
```js
33+
// eslint.config.js
34+
import react from 'eslint-plugin-react'
35+
36+
export default tseslint.config({
37+
// Set the react version
38+
settings: { react: { version: '18.3' } },
39+
plugins: {
40+
// Add the react plugin
41+
react,
42+
},
43+
rules: {
44+
// other rules...
45+
// Enable its recommended rules
46+
...react.configs.recommended.rules,
47+
...react.configs['jsx-runtime'].rules,
48+
},
49+
})
50+
```

uniro_admin_frontend/eslint.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config(
8+
{ ignores: ['dist'] },
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser,
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh,
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': [
23+
'warn',
24+
{ allowConstantExport: true },
25+
],
26+
},
27+
},
28+
)

uniro_admin_frontend/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

uniro_admin_frontend/nginx/nginx.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
include /etc/nginx/mime.types;
7+
default_type application/octet-stream;
8+
9+
server {
10+
listen 3000;
11+
server_name localhost;
12+
13+
location / {
14+
root /usr/share/nginx/html;
15+
index index.html;
16+
try_files $uri /index.html;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)