Skip to content

Commit

Permalink
[Chore] deploy 파일 docker-compose로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
JIHYUN2EE committed Aug 31, 2024
1 parent b326b78 commit 7cc0966
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI/CD Pipeline for Spring Project

# 트리거 설정: 해당 브랜치로 풀리퀘스트가 머지될 때 트리거

# 현재는 테스트니까 푸쉬로
on:
push:
branches: [ "test/#25-workflow-test" ]
Expand Down Expand Up @@ -42,31 +40,6 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker tag fitpet:latest ${{ secrets.DOCKER_USERNAME }}/fitpet:latest
docker push ${{ secrets.DOCKER_USERNAME }}/fitpet:latest
name: CI/CD Pipeline
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to EC2 via SSH
uses: appleboy/ssh-action@v0.1.5
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/fitpet:latest
MYSQL_PASSWORD: ${{ secrets.PROD_MYSQL_PASSWORD }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
port: 22
envs: DOCKER_IMAGE,MYSQL_PASSWORD
script: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker pull ${{ secrets.DOCKER_USERNAME }}/fitpet:latest
cd /home/ubuntu
echo "DOCKER_IMAGE=${DOCKER_IMAGE}" > .env
echo "MYSQL_PASSWORD=${MYSQL_PASSWORD}" >> .env
docker-compose -f docker-compose.yml up --build -d
deploy:
runs-on: ubuntu-latest
Expand All @@ -81,15 +54,14 @@ jobs:
key: ${{ secrets.EC2_SSH_KEY }}
port: 22
script: |
echo $${{ secrets.DOCKER_PASSWORD }} | docker login -u $${{ secrets.DOCKER_USERNAME }} --password-stdin
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker pull ${{ secrets.DOCKER_USERNAME }}/fitpet:latest
cd /home/ubuntu
docker-compose -f docker-compose.yml up --build -d
docker-compose -f docker-compose.yml up --build -d
#name: CI/CD Pipeline for Spring Project
Expand Down

0 comments on commit 7cc0966

Please sign in to comment.