Skip to content

Commit

Permalink
Update dev_deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ss7622 authored Jul 5, 2024
1 parent 0c5cd1d commit 8ff94b5
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 .
Expand All @@ -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
Expand All @@ -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

0 comments on commit 8ff94b5

Please sign in to comment.