Skip to content

Commit

Permalink
cicd: 도커 이미지 업로드 과정 분리 (#35)
Browse files Browse the repository at this point in the history
- 과도한 도커 이미지 생성으로 인해 이미지 빌드및 push 과정을 CD.yml workflow를 만들어 분리하였습니다
  • Loading branch information
7zrv authored Nov 24, 2024
1 parent 075a690 commit 414a61f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
push:
branches: [ main ]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Github Repository 파일 불러오기
uses: actions/checkout@v4

- name: 도커 허브 로그인
run: echo "${{ secrets.DOCKER_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: 도커 이미지 빌드및 Push
run: |
docker build -t 7zrv/somemore:${GITHUB_SHA::7} -t 7zrv/somemore:latest .
docker push 7zrv/somemore:${GITHUB_SHA::7}
docker push 7zrv/somemore:latest
12 changes: 1 addition & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Close PR, if build fail
if: ${{ failure() }}
uses: actions/github-script@v6
with: # actions(uses)의 파라미터 역할
with:
github-token: ${{ github.TOKEN }}
script: |
const pull_number = ${{ github.event.pull_request.number }}
Expand All @@ -93,16 +93,6 @@ jobs:
state: 'closed'
})
- name: 도커 허브 로그인
run:
echo "${{ secrets.DOCKER_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: 도커 빌드및 Push
run: |
docker build -t 7zrv/somemore:${GITHUB_SHA::7} -t 7zrv/somemore:latest .
docker push 7zrv/somemore:${GITHUB_SHA::7}
docker push 7zrv/somemore:latest
- name: SonarCloud 빌드및 분석
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down

0 comments on commit 414a61f

Please sign in to comment.