From 44b6905ea8b6c012a4d65e9c39150f44141e9251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Thu, 14 May 2026 22:37:14 +0900 Subject: [PATCH 1/7] =?UTF-8?q?chore:=20Dockerfile=EC=97=90=20gradlew=20?= =?UTF-8?q?=EA=B6=8C=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1ff21fd..bdbd721 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ WORKDIR /app COPY gradlew . COPY gradle gradle COPY build.gradle settings.gradle ./ +RUN chmod +x gradlew # 2. 의존성 미리 다운로드 ARG GITHUB_USER From 4682edb93c271f11e4c1e132fb87dda468012131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Thu, 14 May 2026 22:43:10 +0900 Subject: [PATCH 2/7] =?UTF-8?q?chore:=20deploy.yml=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 93 ++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..b5fec96 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,93 @@ +name: CI/CD - Build, Test, and Deploy + +on: + pull_request: + branches: + - main + - dev + push: + branches: + - main + - dev + - chore/20-deploy + workflow_dispatch: + +permissions: + id-token: write + contents: read + +env: + AWS_REGION: ap-northeast-2 + ECR_REPOSITORY: first-ticket/program-service + GITHUB_USER: ${{ secrets.GH_USER }} + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'temurin' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v6 + + - name: Grant execute permission to gradlew + run: chmod +x gradlew + + - name: Build & Test + run: ./gradlew build --no-daemon + + - name: Upload test report (on failure) + if: failure() + uses: actions/upload-artifact@v5 + with: + name: test-report + path: build/reports/tests/ + retention-days: 7 + + push-to-ecr: + needs: build-and-test + if: | + github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/chore/20-deploy') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Configure AWS credentials (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: ecr-login + uses: aws-actions/amazon-ecr-login@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build, tag, and push image to ECR + env: + REGISTRY: ${{ steps.ecr-login.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker buildx build --platform linux/amd64 \ + --build-arg GITHUB_USER=${{ secrets.GH_USER }} \ + --secret id=github_token,env=GITHUB_TOKEN \ + -t $REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ + -t $REGISTRY/$ECR_REPOSITORY:latest \ + --push \ + . + + - name: Show pushed image + run: | + echo "✅ Pushed: $ECR_REPOSITORY:${{ github.sha }}" + echo "✅ Pushed: $ECR_REPOSITORY:latest" + From e5bfe4c1b944eea72876af1623951ad71b957c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Thu, 14 May 2026 22:48:56 +0900 Subject: [PATCH 3/7] =?UTF-8?q?remove:=20=EB=B9=8C=EB=93=9C=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20ProgramserviceApplica?= =?UTF-8?q?tionTests.java=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProgramserviceApplicationTests.java | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 src/test/java/com/firstticket/programservice/ProgramserviceApplicationTests.java diff --git a/src/test/java/com/firstticket/programservice/ProgramserviceApplicationTests.java b/src/test/java/com/firstticket/programservice/ProgramserviceApplicationTests.java deleted file mode 100644 index bef091d..0000000 --- a/src/test/java/com/firstticket/programservice/ProgramserviceApplicationTests.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.firstticket.programservice; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; - -@ActiveProfiles("test") -@SpringBootTest -class ProgramserviceApplicationTests { - - @Test - void contextLoads() { - } - -} From 55d33309f80f0ac926ecc2b114c401009c19f7a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Thu, 14 May 2026 22:54:42 +0900 Subject: [PATCH 4/7] =?UTF-8?q?chore:=20Dockerfile=EC=97=90=EC=84=9C=20.en?= =?UTF-8?q?v=20=EB=B3=B5=EC=82=AC=20=EC=A3=BC=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bdbd721..2227423 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,7 @@ COPY --from=builder --chown=spring:spring /app/application/ ./ # [중요] 7. 런타임 환경에 .env 파일 주입 # docker-compose에서 env_file을 사용하더라도, # 애플리케이션 내부에서 직접 파일을 읽는 설정을 위해 복사해두는 것이 안전합니다. -COPY --chown=spring:spring .env .env +#COPY --chown=spring:spring .env .env USER spring From 83d38159ecf350638cd85c7788c69b20b2260c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Thu, 14 May 2026 23:18:31 +0900 Subject: [PATCH 5/7] =?UTF-8?q?chore:=20application.yaml=20inetutils=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index b5f131e..f4bc9ed 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -17,6 +17,11 @@ spring: discovery: enabled: true service-id: config-server + inetutils: + preferred-networks: + - 10\. + - 172\. + - 192\.168\. profiles: active: local # 기본 로컬 실행 From 4fe44f8b62832e32fe269ff2ae41ed2943242b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Fri, 15 May 2026 01:10:48 +0900 Subject: [PATCH 6/7] =?UTF-8?q?chore:=20CD=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=EC=97=90=20ECS=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=EC=8A=A4=ED=85=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b5fec96..3aafaf4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -91,3 +91,15 @@ jobs: echo "✅ Pushed: $ECR_REPOSITORY:${{ github.sha }}" echo "✅ Pushed: $ECR_REPOSITORY:latest" + - name: Download task definition + run: | + aws ecs describe-task-definition --task-definition program-service \ + --query taskDefinition > task-definition.json + + - name: Deploy to ECS + uses: aws-actions/amazon-ecs-deploy-task-definition@v2 + with: + task-definition: task-definition.json + service: program-service + cluster: first-ticket-cluster + wait-for-service-stability: false From 37e35477469c5992f68a7800a636dce206ca787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=ED=95=98=EC=9D=80?= <123haeun@naver.com> Date: Fri, 15 May 2026 01:17:40 +0900 Subject: [PATCH 7/7] =?UTF-8?q?chore:=20CD=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=20=EC=9E=91=EC=97=85=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3aafaf4..9e92da5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,6 @@ on: branches: - main - dev - - chore/20-deploy workflow_dispatch: permissions: @@ -55,7 +54,7 @@ jobs: push-to-ecr: needs: build-and-test if: | - github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/chore/20-deploy') + github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') runs-on: ubuntu-latest steps: - uses: actions/checkout@v6