Skip to content

Commit

Permalink
Merge pull request #127 from boostcampwm2023/release-0.0.1
Browse files Browse the repository at this point in the history
Release 0.0.1
  • Loading branch information
flydog98 authored Nov 27, 2023
2 parents 6cf3791 + 3087261 commit b2db071
Show file tree
Hide file tree
Showing 158 changed files with 23,536 additions and 33 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "backend-docker-build"

on:
push:
branches: [ "dev-be" ]

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# ๋…ธ๋“œ ๋ฒ„์ „ ์„ค์ • ๋ฐ ์˜์กด์„ฑ ์„ค์น˜
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.17.1'

- name: Corepack Enable
run: corepack enable

- name: Install Dependencies
run: yarn install

# ํ…Œ์ŠคํŠธ ์‹คํ–‰ (ํ•„์š”ํ•œ ๊ฒฝ์šฐ)
# - name: Run Tests
# run: yarn test

docker:
name: Deploy Docker Image
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

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

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
file: ./packages/backend/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1

deploy:
name: Deploy Backend
runs-on: ubuntu-latest
needs: docker
steps:
- name: SSH and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BACKEND_SSH_HOST }}
username: ${{ secrets.BACKEND_SSH_USERNAME }}
password: ${{ secrets.BACKEND_SSH_PASSWORD }}
port: ${{ secrets.BACKEND_SSH_PORT }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
docker rm -f backend || true
docker run -d --name backend -p 8080:8080 \
-v /${{ secrets.CONTAINER_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \
-e CONTAINER_SSH_HOST=${{ secrets.CONTAINER_SSH_HOST }} \
-e CONTAINER_SSH_PORT=${{ secrets.CONTAINER_SSH_PORT }} \
-e CONTAINER_SSH_USERNAME=${{ secrets.CONTAINER_SSH_USERNAME }} \
-e CONTAINER_SSH_PASSWORD=${{ secrets.CONTAINER_SSH_PASSWORD }} \
-e MONGODB_HOST=${{ secrets.MONGODB_HOST }} \
${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
73 changes: 73 additions & 0 deletions .github/workflows/frontend-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "frontend-docker-build"

on:
push:
branches: [ "dev-fe" ]

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# ๋…ธ๋“œ ๋ฒ„์ „ ์„ค์ • ๋ฐ ์˜์กด์„ฑ ์„ค์น˜
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.17.1'

- name: Corepack Enable
run: corepack enable

- name: Install Dependencies
run: yarn install

- name: Build
run: |
cd packages/frontend
yarn build
docker:
name: Deploy Docker Image
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

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

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
file: ./packages/frontend/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-frontend:0.1

deploy:
name: Deploy Frontend
runs-on: ubuntu-latest
needs: docker
steps:
- name: SSH and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BACKEND_SSH_HOST }}
username: ${{ secrets.BACKEND_SSH_USERNAME }}
password: ${{ secrets.BACKEND_SSH_PASSWORD }}
port: ${{ secrets.BACKEND_SSH_PORT }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-frontend:0.1
docker rm -f frontend || true
docker run -d --name frontend -p 3000:3000 \
${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-frontend:0.1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
!.yarn/sdks
!.yarn/versions

.eslintcache

.env
14 changes: 14 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh

# ํ˜„์žฌ ๋ธŒ๋žœ์น˜์˜ ์ด๋ฆ„์„ ๊ฐ€์ ธ์˜ค๊ธฐ
current_branch=$(git rev-parse --abbrev-ref HEAD)

if echo "$current_branch" | grep -q "fe"; then
. "$(dirname -- "$0")/_/husky.sh"
yarn workspace frontend run lint-staged
fi

if echo "$current_branch" | grep -q "be"; then
. "$(dirname -- "$0")/_/husky.sh"
yarn workspace backend run lint-staged
fi
Binary file removed .yarn/install-state.gz
Binary file not shown.
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/unsupported-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = absRequire(`eslint/use-at-your-own-risk`);
14 changes: 14 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "eslint",
"version": "8.53.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"packageManager": "[email protected]",
"devDependencies": {
"eslint": "^8.53.0",
"husky": "^8.0.0",
"pinst": "^3.0.0",
"prettier": "^3.1.0",
Expand Down
26 changes: 26 additions & 0 deletions packages/backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ๋ฒ„์ „ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ
.git
.gitignore

# ๋…ธ๋“œ ๋ชจ๋“ˆ
node_modules

# ๋กœ๊ทธ ํŒŒ์ผ
npm-debug.log
yarn-error.log

# ๋นŒ๋“œ ๋””๋ ‰ํ† ๋ฆฌ
dist
build

# ๊ฐœ๋ฐœ ๋„๊ตฌ ์„ค์ •
.editorconfig
*.env
*.env.local
*.env.development.local
*.env.test.local
*.env.production.local

# OS ๊ด€๋ จ ํŒŒ์ผ
.DS_Store
Thumbs.db
25 changes: 25 additions & 0 deletions packages/backend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
39 changes: 39 additions & 0 deletions packages/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

.env

*.sqlite
4 changes: 4 additions & 0 deletions packages/backend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
12 changes: 12 additions & 0 deletions packages/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:18.17.1

WORKDIR /app

COPY . .

RUN corepack enable
RUN yarn install

EXPOSE 8080

CMD ["sh", "-c", "cd packages/backend && yarn run start"]
Loading

0 comments on commit b2db071

Please sign in to comment.