Skip to content

Commit

Permalink
Merge pull request #201 from boostcampwm-2022/dev
Browse files Browse the repository at this point in the history
Week6 Release
  • Loading branch information
jinoo7099 authored Dec 16, 2022
2 parents 270a4e4 + 2b65d8c commit f363442
Show file tree
Hide file tree
Showing 167 changed files with 6,294 additions and 1,314 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/be-dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ jobs:
push: true
# context 명시를 안해주면 이전 step에서 변경되던 사항들이 적용되지 않는다.
context: 'packages/server'
file: 'packages/server/Dockerfile.dev'
tags: |
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_REPOSITORY}}:latest
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_REPOSITORY}}:${{ github.sha }}
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_DEV_REGISTRY}}:latest
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_DEV_REGISTRY}}:${{ github.sha }}
cache-from: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_DEV_REGISTRY}}:buildcache
cache-to: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_DEV_REGISTRY}}:buildcache,mode=max

Build-And-Transfer:
Transfer:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -47,17 +50,11 @@ jobs:
- name: checkout to the branch
uses: actions/checkout@v3

- name: install dependencies
run: npm install

- name: build
run: npm run build

- name: move deploy file to dist
run: mv ./scripts/dev.deploy.sh dist
- name: move deploy file to src
run: mv ./scripts/dev.deploy.sh src

- name: Inject Environment Variables
run: echo "$BE_DEV_ENV" > ./dist/.dev.env
run: echo "$BE_DEV_ENV" > ./src/.dev.env
env:
BE_DEV_ENV: ${{ secrets.BE_DEV_ENV }}

Expand All @@ -68,12 +65,12 @@ jobs:
username: ${{ secrets.REMOTE_SSH_USERNAME }}
password: ${{ secrets.REMOTE_SSH_PASSWORD }}
port: ${{ secrets.REMOTE_SSH_PORT }}
source: 'packages/server/dist/*'
target: '~/server/dist'
source: 'packages/server/src/*'
target: '~/server/src'
strip_components: 3

Deploy:
needs: ['Push-Docker-Image', 'Build-And-Transfer']
needs: ['Push-Docker-Image', 'Transfer']

runs-on: ubuntu-latest

Expand All @@ -85,4 +82,4 @@ jobs:
username: ${{ secrets.REMOTE_SSH_USERNAME }}
password: ${{ secrets.REMOTE_SSH_PASSWORD }}
port: ${{ secrets.REMOTE_SSH_PORT }}
script: . ~/server/dist/dev.deploy.sh ${{secrets.DOCKER_REGISTRY_USERNAME}} ${{secrets.DOCKER_REPOSITORY}}
script: . ~/server/src/dev.deploy.sh ${{secrets.DOCKER_REGISTRY_USERNAME}} ${{secrets.DOCKER_DEV_REGISTRY}} ${{secrets.BUDDAH_CONTAINER_NAME}}
87 changes: 87 additions & 0 deletions .github/workflows/be-prod-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Backend prod cd

on:
push:
branches: ['main']
paths:
- 'packages/server/**'
- '.github/workflows/be-prod-cd.yml'

jobs:
Push-Docker-Image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './packages/server'

steps:
- name: checkout to the branch
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Sign In To Docker Registry
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_REGISTRY_USERNAME}}
password: ${{secrets.BUDDAH_REGISTRY_TOKEN}}

- name: Build Docker Image And Push
uses: docker/build-push-action@v3
with:
push: true
context: 'packages/server'
file: 'packages/server/Dockerfile.prod'
tags: |
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:latest
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:${{ github.sha }}
cache-from: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:buildcache
cache-to: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:buildcache,mode=max

Transfer:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './packages/server'

steps:
- name: checkout to the branch
uses: actions/checkout@v3

- name: make a directory to transfer
run: mkdir transfer

- name: move deploy file to src
run: mv ./scripts/prod.deploy.sh transfer

- name: Inject Environment Variables
run: echo "$BE_PROD_ENV" > ./transfer/.prod.env
env:
BE_PROD_ENV: ${{ secrets.BE_PROD_ENV }}

- name: Transfer to Remote Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_REMOTE_SSH_HOST }}
username: ${{ secrets.PROD_REMOTE_SSH_USERNAME }}
password: ${{ secrets.PROD_REMOTE_SSH_PASSWORD }}
port: ${{ secrets.PROD_REMOTE_SSH_PORT }}
source: 'packages/server/transfer/*'
target: '~/server'
strip_components: 3

Deploy:
needs: ['Push-Docker-Image', 'Transfer']

runs-on: ubuntu-latest

steps:
- name: Deploy To Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_REMOTE_SSH_HOST }}
username: ${{ secrets.PROD_REMOTE_SSH_USERNAME }}
password: ${{ secrets.PROD_REMOTE_SSH_PASSWORD }}
port: ${{ secrets.PROD_REMOTE_SSH_PORT }}
script: . ~/server/prod.deploy.sh ${{secrets.DOCKER_REGISTRY_USERNAME}} ${{secrets.DOCKER_PROD_REGISTRY}} ${{secrets.BUDDAH_CONTAINER_NAME}}
87 changes: 87 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Backend prod cd test

on:
push:
branches: ['feat/be/pm2']
paths:
- 'packages/server/**'
- '.github/workflows/test.yml'

jobs:
Push-Docker-Image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './packages/server'

steps:
- name: checkout to the branch
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Sign In To Docker Registry
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_REGISTRY_USERNAME}}
password: ${{secrets.BUDDAH_REGISTRY_TOKEN}}

- name: Build Docker Image And Push
uses: docker/build-push-action@v3
with:
push: true
context: 'packages/server'
file: 'packages/server/Dockerfile.prod'
tags: |
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:latest
${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:${{ github.sha }}
cache-from: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:buildcache
cache-to: type=registry,ref=${{secrets.DOCKER_REGISTRY_USERNAME}}/${{secrets.DOCKER_PROD_REGISTRY}}:buildcache,mode=max

Transfer:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './packages/server'

steps:
- name: checkout to the branch
uses: actions/checkout@v3

- name: make a directory to transfer
run: mkdir transfer

- name: move deploy file to src
run: mv ./scripts/prod.deploy.sh transfer

- name: Inject Environment Variables
run: echo "$BE_PROD_ENV" > ./transfer/.prod.env
env:
BE_PROD_ENV: ${{ secrets.BE_PROD_ENV }}

- name: Transfer to Remote Server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.PROD_REMOTE_SSH_HOST }}
username: ${{ secrets.PROD_REMOTE_SSH_USERNAME }}
password: ${{ secrets.PROD_REMOTE_SSH_PASSWORD }}
port: ${{ secrets.PROD_REMOTE_SSH_PORT }}
source: 'packages/server/transfer/*'
target: '~/server'
strip_components: 3

Deploy:
needs: ['Push-Docker-Image', 'Transfer']

runs-on: ubuntu-latest

steps:
- name: Deploy To Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_REMOTE_SSH_HOST }}
username: ${{ secrets.PROD_REMOTE_SSH_USERNAME }}
password: ${{ secrets.PROD_REMOTE_SSH_PASSWORD }}
port: ${{ secrets.PROD_REMOTE_SSH_PORT }}
script: . ~/server/prod.deploy.sh ${{secrets.DOCKER_REGISTRY_USERNAME}} ${{secrets.DOCKER_PROD_REGISTRY}} ${{secrets.BUDDAH_CONTAINER_NAME}}
1 change: 1 addition & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@tanstack/react-query": "^4.19.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
26 changes: 19 additions & 7 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import { BrowserRouter } from 'react-router-dom';
import { RecoilRoot } from 'recoil';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import Router from '@/Router';
import Layout from '@/Layout';
import Toast from '@/components/Toast';

import UserRoleProvider from './UserRoleProvider';

function App() {
const queryClient = new QueryClient();

return (
<div className="App">
<RecoilRoot>
<Layout>
<BrowserRouter>
<Router></Router>
</BrowserRouter>
</Layout>
</RecoilRoot>
<QueryClientProvider client={queryClient}>
<RecoilRoot>
<UserRoleProvider>
<Layout>
<BrowserRouter>
<Router></Router>
<Toast />
</BrowserRouter>
</Layout>
</UserRoleProvider>
</RecoilRoot>
</QueryClientProvider>
</div>
);
}
Expand Down
40 changes: 35 additions & 5 deletions packages/client/src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,49 @@ const theme = {
};

const Container = styled.main`
width: 100%;
height: 100%;
min-width: 320px;
min-height: 448px;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
height: 100vh;
min-width: 320px;
max-width: 480px;
min-height: 448px;
background-color: white;
overflow-y: scroll;
&::-webkit-scrollbar {
display: none;
}
@media screen and (min-width: 481px) {
box-shadow: 0px 0px 4px rgba(204, 204, 204, 0.5),
0px 0px 4px rgba(0, 0, 0, 0.25);
}
@media screen and (min-width: 481px) {
left: calc(10% - 50px);
}
`;

const MobileFirst = styled.div`
width: 100%;
height: 100vh;
@media screen and (min-width: 481px) {
background-image: url('https://kr.object.ncloudstorage.com/buddha-dev/logo.png');
background-repeat: no-repeat;
background-position: center;
}
`;

function Layout({ children }: Props) {
return (
<ThemeProvider theme={theme}>
<Container>{children}</Container>
<MobileFirst>
<Container>{children}</Container>
</MobileFirst>
</ThemeProvider>
);
}
Expand Down
Loading

0 comments on commit f363442

Please sign in to comment.