Skip to content

Commit

Permalink
[feat] #205 - 작업 단계 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
Oodls authored Oct 13, 2024
1 parent c8a13ca commit fddcdb4
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ jobs:
- name: Build with Gradle Wrapper
run: ./gradlew -x test bootJar

docker:
runs-on: ubuntu-latest
needs: build # build 작업이 완료되어야 실행
permissions:
contents: read

steps:
# 4. Docker Buildx 설정
- name: Set up Docker Build
uses: docker/setup-buildx-action@v1
Expand All @@ -39,19 +46,30 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

# 6. Docker 이미지 빌드 및 배포
- name: Build and push Docker image
# 6. Docker 이미지 빌드
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/rankitrun-be:latest .
# 7. Docker 이미지 푸시
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/rankitrun-be:latest
# 7. EC2 SSH 접속을 위한 키 등록
deploy:
runs-on: ubuntu-latest
needs: docker # docker 작업이 완료되어야 실행
permissions:
contents: read

steps:
# 8. EC2 SSH 접속을 위한 키 등록
- name: Set up SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.EC2_SSH_KEY }}

# 8. EC2에 blue green 무중단 배포를 위한 스크립트 실행
# 9. EC2에 blue green 무중단 배포를 위한 스크립트 실행
- name: Run dPlanner.sh for CICD and switch blue-green container
run: |
ssh -o StrictHostKeyChecking=no ec2-user@${{ secrets.EC2_HOST }} << 'EOF'
Expand Down

0 comments on commit fddcdb4

Please sign in to comment.