Skip to content

Commit

Permalink
Merge pull request #254 from Denia-park/chore/depolyment-개선
Browse files Browse the repository at this point in the history
CD 속도 개선 및 README 업데이트
  • Loading branch information
Denia-park authored Feb 28, 2024
2 parents b72c542 + a6bae67 commit 2b6982a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
45 changes: 22 additions & 23 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ on:
- my-garden-fe/**

env:
# GitHub Container Registry에 푸시할 이미지 정보 (ACTOR: GitHub 사용자명 / DOCKER_IMAGE: 이미지명 / VERSION: GitHub SHA / NAME: 컨테이너명)
# GitHub Container Registry에 푸시할 이미지 정보 (ACTOR: GitHub 사용자명 / DOCKER_IMAGE: 이미지명 / NAME: 컨테이너명)
# DOCKER_IMAGE를 만들때는 대문자가 포함되어서는 안됨, ACTOR에는 대문자가 포함되어도 상관없지만, 통일성을 위해 소문자로 작성 => 본인 계정에 맞게 변경해서 사용할 것
ACTOR: denia-park
DOCKER_IMAGE: ghcr.io/denia-park/my-garden
VERSION: ${{ github.sha }}
NAME: my-garden

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

defaults:
run:
working-directory: ./my-garden-be

steps:
- uses: actions/checkout@v4

Expand All @@ -35,27 +30,35 @@ jobs:
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew
run: chmod +x my-garden-be/gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0

- name: Build with Gradle Wrapper
# node_modules 캐시 체크
- name: Check node modules cache
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build with Gradle Wrapper (skip npm install)
if: steps.cache.outputs.cache-hit == 'true'
run: ./gradlew build -x npmInstall
working-directory: ./my-garden-be

- name: Build with Gradle Wrapper (npm install)
if: steps.cache.outputs.cache-hit != 'true'
run: ./gradlew build
working-directory: ./my-garden-be

# docker build 수행
# docker buildx 설치
- name: Set up docker buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Cache docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.VERSION }}
restore-keys: |
${{ runner.os }}-buildx-
# GitHub Container Registry에 로그인
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -64,17 +67,13 @@ jobs:
username: ${{ env.ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}

# Docker 빌드 & GitHub Container Registry에 푸시
# Docker Image 빌드 & GitHub Container Registry에 푸시
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ env.DOCKER_IMAGE }}:latest
cache-from: type=gha # 여기서 gha 는 Guthub Actions 용 캐시를 의미합니다.
cache-to: type=gha,mode=max

deploy:
name: Deploy
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@
5. [AWS를 이용해서 HTTPS 적용 후 HTTPS가 반영이 안될 때 확인 방법](https://velog.io/@as9587/AWS%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%B4%EC%84%9C-HTTPS-%EC%A0%81%EC%9A%A9-%ED%9B%84-HTTPS%EA%B0%80-%EB%B0%98%EC%98%81%EC%9D%B4-%EC%95%88%EB%90%A0-%EB%95%8C-%ED%99%95%EC%9D%B8-%EB%B0%A9%EB%B2%95)
6. [[Vue + Spring] Github Actions를 이용한 CI/CD 구축하기 (+ Jacoco PR Comment 기능)](https://velog.io/@as9587/Vue-Spring-Github-Actions%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%9C-CICD-%EA%B5%AC%EC%B6%95%ED%95%98%EA%B8%B0-Jacoco-PR-Comment-%EA%B8%B0%EB%8A%A5)
7. [[Prometheus + Grafana] Monitoring 도입하기 ( + Node Exporter)](https://velog.io/@as9587/Prometheus-Grafana-Monitoring-%EB%8F%84%EC%9E%85%ED%95%98%EA%B8%B0-Node-Exporter)
8. [GitHub Actions 기반의 CI 속도 개선 [Vue.js Build]](https://velog.io/@as9587/GitHub-Actions-%EA%B8%B0%EB%B0%98%EC%9D%98-CI-%EC%86%8D%EB%8F%84-%EA%B0%9C%EC%84%A0-Vue.js-Build)
9. [GitHub Actions 기반의 CD 속도 개선](https://velog.io/@as9587/GitHub-Actions-%EA%B8%B0%EB%B0%98%EC%9D%98-CD-%EC%86%8D%EB%8F%84-%EA%B0%9C%EC%84%A0)

## API Docs (Spring Rest Docs)

Expand Down Expand Up @@ -493,7 +495,6 @@
- 구글
- Redis 적용
- 글 작성 수 혹은 조회수로 랭킹 만들기
- 주간 및 월간 통계 내기
- 부하 테스트 진행하기
- 로깅 설정 추가하기
- 습관 만들기
Expand Down

0 comments on commit 2b6982a

Please sign in to comment.