Skip to content

Commit

Permalink
udpate :: ci cd 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
KimGyeongsuuu committed Sep 21, 2024
1 parent f83dd0a commit 09d0501
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 51 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/cd.yml

This file was deleted.

30 changes: 27 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Indistraw CI
name: Indistraw CI / CD

on:
push:
Expand Down Expand Up @@ -32,8 +32,32 @@ jobs:

## Docker image build
- name: Build the Docker image
run: docker build --platform linux/amd64 -t ${{secrets.DOCKERHUB_USERNAME}}/indistraw-server .
run: docker build --platform linux/amd64 -t ${{secrets.DOCKERHUB_USERNAME}}/indistraw-service .

## Docker image push
- name: Docker Push
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/indistraw-server
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/indistraw-service

## EC2 인스턴스에 접속하여 Docker Compose 작업 수행
- name: SSH into EC2 and run Docker Compose
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
port: ${{ secrets.EC2_SSH_PORT }}
script: |
# Docker-Compose Down
cd /IndiStraw-Monolithic-Server
sudo docker-compose down || true
# Docker-Compose Pull
sudo docker pull ${{ secrets.DOCKER_REPO }}/indistraw-service
sudo docker pull mysql
sudo docker pull redis
# Docker-Compose Up
sudo docker-compose up -d
# Docker-Image Prune
sudo docker image prune -f

0 comments on commit 09d0501

Please sign in to comment.