From 8ff94b51a451c121e31e0828622b3992833a6334 Mon Sep 17 00:00:00 2001 From: Junbeom Lee <63588899+ss7622@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:24:19 +0900 Subject: [PATCH] Update dev_deploy.yml --- .github/workflows/dev_deploy.yml | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index eb7fb57..ff90a23 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -40,8 +40,7 @@ jobs: key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-gradle- - - + # Gradle을 사용하여 프로젝트를 빌드합니다. - name: Build With Gradle run: ./gradlew build -x test @@ -55,7 +54,7 @@ jobs: key: ${{ secrets.EC2_SSH_KEY }} script: | mkdir -p /home/ubuntu/deploy - + # docker-compose 복사 - name: Copy docker-compose.yml uses: appleboy/scp-action@master @@ -66,7 +65,6 @@ jobs: source: "docker-compose.yml" target: "/home/ubuntu/deploy/" - # Docker 이미지를 빌드합니다. - name: docker image build run: docker build -t qormoon/fiurinee_docker . @@ -82,15 +80,12 @@ jobs: - name: docker Hub push run: docker push qormoon/fiurinee_docker - - # 새로 빌드된 Docker 이미지를 EC2 서버에 배포하는 작업을 정의 deploy: needs: build-docker-image # build-docker-image 작업이 완료된 후에 실행 runs-on: ubuntu-latest # 워크플로우가 실행될 환경을 지정합니다. steps: - # EC2 서버에 SSH로 접속하여 Docker 이미지를 pull하고 컨테이너를 재시작 - name: Deploy to EC2 uses: appleboy/ssh-action@master @@ -108,27 +103,11 @@ jobs: echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> ~/deploy/.env echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> ~/deploy/.env echo "JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}" >> ~/deploy/.env - echo "SMS_API_KEY=${{ secrets.SMS_API_KEY }}" >> ~/deploy/.env echo "SMS_SECRET_KEY=${{ secrets.SMS_SECRET_KEY }}" >> ~/deploy/.env -# echo "MAIL_USERNAME=${{ secrets.MAIL_USERNAME }}" >> ~/deploy/.env -# echo "MAIL_PASSWORD=${{ secrets.MAIL_PASSWORD }}" >> ~/deploy/.env + # echo "MAIL_USERNAME=${{ secrets.MAIL_USERNAME }}" >> ~/deploy/.env + # echo "MAIL_PASSWORD=${{ secrets.MAIL_PASSWORD }}" >> ~/deploy/.env sudo docker-compose -f ~/deploy/docker-compose.yml pull sudo docker-compose -f ~/deploy/docker-compose.yml up -d sudo docker image prune -f - - -# # 배포 -# - name: Deploy -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.EC2_HOST }} -# username: ubuntu -# key: ${{ secrets.EC2_SSH_KEY }} -# envs: GITHUB_SHA -# script: | -# sudo docker ps -# sudo docker pull qormoon/fiurinee_docker -# sudo docker run -d -p 8080:8080 qormoon/fiurinee_docker -# sudo docker image prune -f