Skip to content

Commit

Permalink
feat: CD 파이프라인 구축
Browse files Browse the repository at this point in the history
  • Loading branch information
GiHwan2 authored Sep 28, 2024
1 parent 01e86cc commit 3cf95d9
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/CI.yml → .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ name: Java CI with Gradle

on:
push:
branches: [ "main" ]
branches: [ "develop" ]

jobs:
build:
ci:

runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -48,7 +48,28 @@ jobs:
# 5. Docker Hub 이미지 푸시
- name: docker Hub push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/groomthonUniv


cd:
# build-docker-image (위)과정이 완료되어야 실행됩니다.
needs: ci
runs-on: self-hosted

steps:
# 1. 최신 이미지를 풀받습니다
- name: docker pull
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/groomthonUniv

# 2. 기존의 컨테이너를 중지시킵니다
- name: docker stop container
run: sudo docker stop $(sudo docker ps -q) 2>/dev/null || true

# 3. 최신 이미지를 컨테이너화하여 실행시킵니다
- name: docker run new container
run: sudo docker run --name github-actions-demo --rm -d -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo

# 4. 미사용 이미지를 정리합니다
- name: delete old docker image
run: sudo docker system prune -f
# dependency-submission:

# runs-on: ubuntu-latest
Expand Down

0 comments on commit 3cf95d9

Please sign in to comment.