diff --git a/.github/workflows/pr-frontend-dev.yml b/.github/workflows/build-frontend-dev.yml similarity index 75% rename from .github/workflows/pr-frontend-dev.yml rename to .github/workflows/build-frontend-dev.yml index 91bfeae9..20aaa854 100644 --- a/.github/workflows/pr-frontend-dev.yml +++ b/.github/workflows/build-frontend-dev.yml @@ -1,11 +1,11 @@ -name: Dev Frontend Build and Test +name: Build Frontend - Dev on: - push: + pull_request: branches: [ dev ] paths: - 'frontend/**' - - '.github/workflows/dev-frontend.yml' + - '.github/workflows/build-frontend-dev.yml' workflow_dispatch: # 수동 실행 버튼 활성화 inputs: force_build_all: @@ -17,7 +17,6 @@ on: jobs: # 변경된 앱 감지 detect-changes: - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'false') runs-on: ubuntu-24.04 outputs: admin-changed: ${{ steps.changes.outputs.admin }} @@ -28,14 +27,11 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 2 # 이전 커밋과 비교하기 위해 - name: Detect changes uses: dorny/paths-filter@v3 id: changes with: - base: HEAD~1 filters: | admin: - 'frontend/apps/admin/**' @@ -48,31 +44,17 @@ jobs: # Admin 앱 빌드 및 테스트 build-admin: - needs: [detect-changes] + needs: detect-changes if: | - always() && ( - (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || - (needs.detect-changes.result == 'success' && (needs.detect-changes.outputs.admin-changed == 'true' || needs.detect-changes.outputs.packages-changed == 'true')) || - needs.detect-changes.result == 'skipped' - ) + (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || + needs.detect-changes.outputs.admin-changed == 'true' || + needs.detect-changes.outputs.packages-changed == 'true' runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - cache-dependency-path: 'frontend/package-lock.json' - - - name: Install dependencies - run: | - cd frontend - npm ci --include-workspace-root --workspaces - - name: Build Admin App run: | cd frontend @@ -115,31 +97,17 @@ jobs: # Contents 앱 빌드 및 테스트 build-contents: - needs: [detect-changes] + needs: detect-changes if: | - always() && ( - (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || - (needs.detect-changes.result == 'success' && (needs.detect-changes.outputs.contents-changed == 'true' || needs.detect-changes.outputs.packages-changed == 'true')) || - needs.detect-changes.result == 'skipped' - ) + (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || + needs.detect-changes.outputs.contents-changed == 'true' || + needs.detect-changes.outputs.packages-changed == 'true' runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - cache-dependency-path: 'frontend/package-lock.json' - - - name: Install dependencies - run: | - cd frontend - npm ci --include-workspace-root --workspaces - - name: Build Contents App run: | cd frontend @@ -182,31 +150,17 @@ jobs: # Seller 앱 빌드 및 테스트 build-seller: - needs: [detect-changes] + needs: detect-changes if: | - always() && ( - (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || - (needs.detect-changes.result == 'success' && (needs.detect-changes.outputs.seller-changed == 'true' || needs.detect-changes.outputs.packages-changed == 'true')) || - needs.detect-changes.result == 'skipped' - ) + (github.event_name == 'workflow_dispatch' && github.event.inputs.force_build_all == 'true') || + needs.detect-changes.outputs.seller-changed == 'true' || + needs.detect-changes.outputs.packages-changed == 'true' runs-on: ubuntu-24.04 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - cache-dependency-path: 'frontend/package-lock.json' - - - name: Install dependencies - run: | - cd frontend - npm ci --include-workspace-root --workspaces - - name: Build Seller App run: | cd frontend @@ -284,7 +238,9 @@ jobs: fi echo "" - echo "🎯 빌드 트리거: ${{ github.event_name }}" if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "🎯 빌드 트리거: Manual Dispatch" echo "🔧 강제 전체 빌드: ${{ github.event.inputs.force_build_all }}" + else + echo "🎯 빌드 트리거: Pull Request to dev branch" fi \ No newline at end of file diff --git a/.github/workflows/pr-frontend.yml b/.github/workflows/build-frontend.yml similarity index 98% rename from .github/workflows/pr-frontend.yml rename to .github/workflows/build-frontend.yml index 7c823f53..d1972b5f 100644 --- a/.github/workflows/pr-frontend.yml +++ b/.github/workflows/build-frontend.yml @@ -1,11 +1,11 @@ -name: PR Frontend Build and Push +name: Build Frontend - Main on: pull_request: branches: [ main ] paths: - 'frontend/**' - - '.github/workflows/pr-frontend.yml' + - '.github/workflows/build-frontend.yml' env: ECR_REGISTRY: public.ecr.aws/x2l9m6x8/selfscape/moimjang diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml index 3d24e892..ecf22e3a 100644 --- a/.github/workflows/deploy-frontend.yml +++ b/.github/workflows/deploy-frontend.yml @@ -136,7 +136,7 @@ jobs: docker run -d \ --name moimjang-frontend-contents \ --restart unless-stopped \ - -p 3132:3000 \ + -p 3133:3000 \ ${{ env.ECR_REGISTRY }}-contents:$IMAGE_TAG echo "✅ New contents container started successfully" @@ -144,7 +144,7 @@ jobs: run: | echo "🔍 Performing health check for contents app..." sleep 10 - if curl -f http://localhost:3132 > /dev/null 2>&1; then + if curl -f http://localhost:3133 > /dev/null 2>&1; then echo "✅ Contents app is healthy and responding" else echo "❌ Contents app health check failed" @@ -195,7 +195,7 @@ jobs: docker run -d \ --name moimjang-frontend-seller \ --restart unless-stopped \ - -p 3133:3000 \ + -p 3132:3000 \ ${{ env.ECR_REGISTRY }}-seller:$IMAGE_TAG echo "✅ New seller container started successfully" @@ -203,7 +203,7 @@ jobs: run: | echo "🔍 Performing health check for seller app..." sleep 10 - if curl -f http://localhost:3133 > /dev/null 2>&1; then + if curl -f http://localhost:3132 > /dev/null 2>&1; then echo "✅ Seller app is healthy and responding" else echo "❌ Seller app health check failed" diff --git a/backend/webapp/repositories.py b/backend/webapp/repositories.py index 6ad4de3d..f09b6ce7 100644 --- a/backend/webapp/repositories.py +++ b/backend/webapp/repositories.py @@ -753,6 +753,23 @@ def is_object_exists(self, object_key: str, file_size: int) -> bool: except S3Error: return False + def get_presigned_url( + self, object_key: str, expires: timedelta = timedelta(days=1) + ) -> str: + try: + stat = self.client.stat_object(self.bucket_name, object_key) + content_type = stat.content_type + response_headers = {"response-content-type": content_type} + return self.client.presigned_get_object( + self.bucket_name, + object_key, + expires=expires, + response_headers=response_headers, # type: ignore + ) + except S3Error as e: + logger.error(f"Failed to generate presigned URL: {str(e)}") + return "" + def get_img_proxy_url(self, object_path: str) -> str: """ S3 오브젝트 경로를 이미지 프록시 URL로 변환합니다. diff --git a/frontend/apps/contents/package.json b/frontend/apps/contents/package.json index c539baf8..02cdaabe 100644 --- a/frontend/apps/contents/package.json +++ b/frontend/apps/contents/package.json @@ -14,4 +14,4 @@ "eslint-config-next": "15.1.8", "typescript": "^5" } -} +} \ No newline at end of file