Skip to content

Commit

Permalink
GIthub action과 docker를 통한 CI/CD 구축
Browse files Browse the repository at this point in the history
GIthub action과 docker를 통한 CI/CD 구축
  • Loading branch information
seoko97 authored Sep 26, 2023
2 parents cd60e84 + dfeca33 commit 069a0d5
Show file tree
Hide file tree
Showing 364 changed files with 10,220 additions and 716 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.next
.storybook
.vscode
.git
.github
tests
.yarn/sdks
node_modules
4 changes: 0 additions & 4 deletions .env

This file was deleted.

18 changes: 10 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ module.exports = {
plugins: ["prettier", "@typescript-eslint", "import"],
rules: {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/display-name": "off",
"react-hooks/exhaustive-deps": "off",
"react/no-unknown-property": ["error", { ignore: ["css"] }],
"@next/next/no-html-link-for-pages": "off",
"import/default": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: false }],
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": [1, { args: "after-used", argsIgnorePattern: "^_" }],
"import/order": [
"error",
{
Expand All @@ -27,14 +37,6 @@ module.exports = {
"newlines-between": "always-and-inside-groups",
},
],
"import/default": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-unused-vars": [1, { args: "after-used", argsIgnorePattern: "^_" }],
"@typescript-eslint/no-empty-interface": ["error", { allowSingleExtends: false }],
"react/prop-types": "off",
"react/display-name": "off",
"react/no-unknown-property": ["error", { ignore: ["css"] }],
"@typescript-eslint/no-unused-vars": "warn",
},
env: {
browser: true,
Expand Down
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: issue_template
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

## :briefcase: **구현 개요**

## :white_check_mark: **진행 계획 및 현황**

- [ ]
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: pull_request_template
about: PR에 대한 상세내용
title: ''
labels: ''
assignees: ''
---

- Closes #이슈번호

## **구현 기능 명세**

## 🎁 **주목할 점**

## 😭 **어려웠던 점**

## 🌄 **스크린샷**
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: SEOKO Client Deploy

on:
push:
branches: ["main"]

jobs:
build:
name: Build and Push Project
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 16

- name: Install the project dependencies
run: yarn install

- name: Create .env file
run: |
jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< "$SECRETS_CONTEXT" > .env
cat .env
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}

- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{secrets.DOCKER_REGISTRY_URL}}
username: ${{secrets.DOCKER_REGISTRY_ACCESS_KEY}}
password: ${{secrets.DOCKER_REGISTRY_SECRET_KEY}}

- name: Docker build & push to push
run: docker buildx build -t ${{secrets.DOCKER_REGISTRY_URL}}/${{secrets.FRONT_DOCKER_IMAGE_NAME}}:${{ github.sha }} -t ${{secrets.DOCKER_REGISTRY_URL}}/${{secrets.FRONT_DOCKER_IMAGE_NAME}}:latest --push .

deploy:
needs: build
name: Deploy
runs-on: [seoko-client]
steps:
- name: Login to Docker Registry
uses: docker/login-action@v2
with:
registry: ${{secrets.DOCKER_REGISTRY_URL}}
username: ${{secrets.DOCKER_REGISTRY_ACCESS_KEY}}
password: ${{secrets.DOCKER_REGISTRY_SECRET_KEY}}

- name: Docker run
run: |
if [ `docker ps -f "name=front" -q` ]
then
docker rm -f $(docker ps -f "name=front" -q)
fi
docker pull ${{secrets.DOCKER_REGISTRY_URL}}/${{secrets.FRONT_DOCKER_IMAGE_NAME}}:${{ github.sha }}
docker run -dit -p 3000:3000 --name front ${{secrets.DOCKER_REGISTRY_URL}}/${{secrets.FRONT_DOCKER_IMAGE_NAME}}:${{ github.sha }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ next-env.d.ts
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/versions

# environment variables
.env
Loading

0 comments on commit 069a0d5

Please sign in to comment.