Skip to content

Commit

Permalink
v1.1.0(스프린트 2 구현)
Browse files Browse the repository at this point in the history
v1.1.0(스프린트 2 구현)
  • Loading branch information
mikekks authored Feb 7, 2025
2 parents f56d29a + 1aec36c commit 969b7ae
Show file tree
Hide file tree
Showing 221 changed files with 12,627 additions and 714 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
70 changes: 70 additions & 0 deletions .github/workflows/be-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Uniro-server CD

on:
push:
branches:
- be

jobs:
uniro-ci:
name: Build & Push Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}

- name: Create application.properties from secret
run: |
echo "${{ secrets.BE_SPRING_APPLICATION_SECRET }}" > ./uniro_backend/src/main/resources/application.properties
shell: bash

- name: Build Spring Boot Application
run: |
cd uniro_backend
./gradlew clean build -x test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker Hub Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }}
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }}

- name: Build & Push Multi-Arch Docker Image
run: |
cd uniro_backend
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 -t uniro5th/uniro-docker-repo:develop --build-arg SPRING_PROFILE=dev --push .
deploy-run:
name: Deploy to Server
needs: uniro-ci
runs-on: ubuntu-latest
steps:
- name: Run Docker Container on Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BE_SERVER_IP }}
username: ${{ secrets.BE_SERVER_USER }}
key: ${{ secrets.BE_SERVER_KEY }}
script: |
cd ~/myapp
chmod +x ./deploy.sh
./deploy.sh
42 changes: 42 additions & 0 deletions .github/workflows/be-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Uniro-server CI

on:
pull_request:
branches:
- be

jobs:
build-springboot:
name: Build and analyze (SpringBoot)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}

- name: Create application.properties from secret
run: |
echo "${{ secrets.BE_SPRING_APPLICATION_SECRET }}" > ./uniro_backend/src/main/resources/application.properties
shell: bash

- name: Debug application.properties
run: cat ./uniro_backend/src/main/resources/application.properties

- name: Build and analyze (SpringBoot)
run: |
cd uniro_backend
./gradlew clean build -x test
66 changes: 66 additions & 0 deletions .github/workflows/fe-admin-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: FE ADMIN CI / CD

on:
push:
branches:
- fe

jobs:
CI:
runs-on: ubuntu-latest

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-backoffice
IMAGE_TAG: ${{ github.sha }}

steps:
- name: 코드 체크아웃
uses: actions/checkout@v4

- name: Google Cloud SDK 설정
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Docker를 위한 gcloud 인증 설정
run: gcloud auth configure-docker --quiet

- name: Create .env from secret
run: |
echo "${{ secrets.FE_ENV }}" > uniro_admin_frontend/.env
- name: Docker 이미지 빌드 및 푸시
run: |
docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_admin_frontend/Dockerfile .
docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
CD:
runs-on: ubuntu-latest
needs: CI

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-backoffice
IMAGE_TAG: ${{ github.sha }}
DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }}

steps:
- name: 배포 서버에 SSH로 연결하여 배포
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_SERVER_HOST }}
username: ${{ secrets.DEPLOY_SERVER_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST
script: |
cd ${DEPLOY_PATH}
sudo docker ps -a --format '{{.ID}} {{.Names}}' \
| egrep -v 'nginx-container|uniro-fe' \
| awk '{print $1}' \
| xargs -r sudo docker stop || true
sudo docker rm $(sudo docker ps -a -q) || true
sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}'
sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker run -d --name ${IMAGE_NAME} -p 3001:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker network connect nginx_app-network ${IMAGE_NAME}
104 changes: 52 additions & 52 deletions .github/workflows/fe-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
name: FE CI / CD

on:
push:
branches:
- fe
push:
branches:
- fe

jobs:
CI:
runs-on: ubuntu-latest
CI:
runs-on: ubuntu-latest

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-fe
IMAGE_TAG: ${{ github.sha }}
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-fe
IMAGE_TAG: ${{ github.sha }}

steps:
- name: 코드 체크아웃
uses: actions/checkout@v4
steps:
- name: 코드 체크아웃
uses: actions/checkout@v4

- name: Google Cloud SDK 설정
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Google Cloud SDK 설정
uses: "google-github-actions/auth@v2"
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Docker를 위한 gcloud 인증 설정
run: gcloud auth configure-docker --quiet
- name: Docker를 위한 gcloud 인증 설정
run: gcloud auth configure-docker --quiet

- name: Create .env from secret
run: |
echo "${{ secrets.FE_ENV }}" > uniro_frontend/.env
- name: Create .env from secret
run: |
echo "${{ secrets.FE_ENV }}" > uniro_frontend/.env
- name: Docker 이미지 빌드 및 푸시
run: |
docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_frontend/Dockerfile .
docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Docker 이미지 빌드 및 푸시
run: |
docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_frontend/Dockerfile .
docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
CD:
runs-on: ubuntu-latest
needs: CI
CD:
runs-on: ubuntu-latest
needs: CI

env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-fe
IMAGE_TAG: ${{ github.sha }}
DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }}
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
IMAGE_NAME: uniro-fe
IMAGE_TAG: ${{ github.sha }}
DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }}

steps:
- name: 배포 서버에 SSH로 연결하여 배포
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_SERVER_HOST }}
username: ${{ secrets.DEPLOY_SERVER_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST
script: |
cd ${DEPLOY_PATH}
sudo docker ps -a --format '{{.ID}} {{.Names}}' \
| grep -v 'nginx-container' \
| awk '{print $1}' \
| xargs -r sudo docker stop || true
sudo docker rm $(sudo docker ps -a -q) || true
sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}'
sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker run -d --name ${IMAGE_NAME} -p 3000:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker network connect nginx_app-network ${IMAGE_NAME}
steps:
- name: 배포 서버에 SSH로 연결하여 배포
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_SERVER_HOST }}
username: ${{ secrets.DEPLOY_SERVER_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST
script: |
cd ${DEPLOY_PATH}
sudo docker ps -a --format '{{.ID}} {{.Names}}' \
| egrep -v 'nginx-container|uniro-backoffice' \
| awk '{print $1}' \
| xargs -r sudo docker stop || true
sudo docker rm $(sudo docker ps -a -q) || true
sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}'
sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker run -d --name ${IMAGE_NAME} -p 3000:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG}
sudo docker network connect nginx_app-network ${IMAGE_NAME}
26 changes: 26 additions & 0 deletions uniro_admin_frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
15 changes: 15 additions & 0 deletions uniro_admin_frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:22-slim AS build

WORKDIR /app
COPY ./uniro_admin_frontend .

RUN npm install --legacy-peer-deps --no-audit && npm run build

FROM nginx

COPY uniro_admin_frontend/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 3000

CMD ["nginx", "-g", "daemon off;"]
50 changes: 50 additions & 0 deletions uniro_admin_frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@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
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
Loading

0 comments on commit 969b7ae

Please sign in to comment.