From c2e222302d0b20909b72db0f5c87b3ece362dfb7 Mon Sep 17 00:00:00 2001 From: marshmallowing Date: Sun, 21 Sep 2025 17:27:58 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20cd=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yaml | 59 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 8 ++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/cd.yaml create mode 100644 docker-compose.yml diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 0000000..a22dd09 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,59 @@ +name: CD + +on: + push: + branches: [ "develop", "main" ] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + # 깃 레포 체크아웃 + - name: Checkout repository + uses: actions/checkout@v4 + + # 배포용 파일 다운로드 + - name: Download deployment files + uses: actions/download-artifact@v4 + with: + name: deployment-files + path: . + + # 압축 해제 + - name: Extract deployment files + run: tar -xzvf deploy.tar.gz + + # EC2로 파일 전송 + - name: Copy files to EC2 + uses: appleboy/scp-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: 22 + source: "docker-compose.yml,.env" + target: "/home/ubuntu/growin/" + + # EC2에서 도커 컨테이너 재배포 + - name: Deploy to EC2 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: 22 + script: | + cd /home/ubuntu/growin + + # 1. 최신 이미지 pull + sudo docker-compose pull + + # 2. 기존 컨테이너 중단 및 삭제 + sudo docker-compose down || true + + # 3. 컨테이너 재시작 + sudo docker-compose up -d + + # 4. 안 쓰는 이미지 정리 + sudo docker image prune -a -f diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4e4643c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + growin-api: + image: ghcr.io/ita-8th-team3/growin-server:latest + container_name: growin-api + ports: + - "8080:8080" + env_file: + - .env \ No newline at end of file From e68f7efa55f92ed1b5883694e9c9cca5091de159 Mon Sep 17 00:00:00 2001 From: marshmallowing Date: Fri, 10 Oct 2025 23:07:35 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20artifact=20=EC=82=AD=EC=A0=9C,=20env?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{cd.yaml => cd.yml} | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) rename .github/workflows/{cd.yaml => cd.yml} (78%) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yml similarity index 78% rename from .github/workflows/cd.yaml rename to .github/workflows/cd.yml index a22dd09..af379b2 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yml @@ -2,7 +2,7 @@ name: CD on: push: - branches: [ "develop", "main" ] + branches: [ "main" ] jobs: deploy: @@ -13,16 +13,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - # 배포용 파일 다운로드 - - name: Download deployment files - uses: actions/download-artifact@v4 - with: - name: deployment-files - path: . - - # 압축 해제 - - name: Extract deployment files - run: tar -xzvf deploy.tar.gz + # .env 생성 + - name: Create .env file + run: echo "${{ secrets.ENV_FILE }}" > .env # EC2로 파일 전송 - name: Copy files to EC2 From 9515aa28970ffd43ff92ef95c2f66217c815feb8 Mon Sep 17 00:00:00 2001 From: marshmallowing Date: Fri, 10 Oct 2025 23:08:21 +0900 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{gradle.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{gradle.yml => ci.yml} (100%) diff --git a/.github/workflows/gradle.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/gradle.yml rename to .github/workflows/ci.yml From ce9165e322a42b9aea16173e18e71b39e9698adf Mon Sep 17 00:00:00 2001 From: marshmallowing Date: Fri, 10 Oct 2025 23:22:55 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20docker-compose=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4e4643c..50ec9e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ services: growin-api: - image: ghcr.io/ita-8th-team3/growin-server:latest + image: ghcr.io/growin-2025/growin-server:latest container_name: growin-api ports: - "8080:8080" env_file: - - .env \ No newline at end of file + - .env