From 4e0bef5046838821ac90d0bab52ab80415a54ad0 Mon Sep 17 00:00:00 2001 From: Subin Cho Date: Fri, 25 Apr 2025 13:59:30 +0900 Subject: [PATCH 1/3] =?UTF-8?q?chore=20=20=20|=20sprint0=20|=20=EC=97=86?= =?UTF-8?q?=EC=9D=8C=20|=20workflow=20=EC=84=A4=EC=A0=95=20|=20=EC=A1=B0?= =?UTF-8?q?=EC=88=98=EB=B9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/develop_pull_request.yml | 60 ++++++++++++++++++++++ Dockerfile | 15 ++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/develop_pull_request.yml create mode 100644 Dockerfile diff --git a/.github/workflows/develop_pull_request.yml b/.github/workflows/develop_pull_request.yml new file mode 100644 index 0000000..8ab4cd2 --- /dev/null +++ b/.github/workflows/develop_pull_request.yml @@ -0,0 +1,60 @@ +name: Test and Build Docker Image to ECR + +on: + pull_request: + branches: + - main + +jobs: + build-and-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache node_modules + uses: actions/cache@v3 + with: + path: | + **/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + + - name: Install dependencies + run: npm ci + + - name: Test + run: npm test + + - name: Build + run: npm run build + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-northeast-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build and push image to ECR + env: + ECR_REGISTRY: ${{ secrets.AWS_ECR_REGISTRY }} + ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY }} + IMAGE_TAG: frontend-latest + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4a197c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:18 + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm install + +COPY . . + +ENV NODE_ENV=development +ENV HOST=0.0.0.0 + +EXPOSE 5173 + +CMD ["npm", "run", "dev", "--", "--host" ] \ No newline at end of file From b9b5d6c888ec4e070d1b8cac0f819e97a3bad379 Mon Sep 17 00:00:00 2001 From: Subin Cho Date: Fri, 25 Apr 2025 14:14:39 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore=20=20=20|=20sprint0=20|=20=EC=97=86?= =?UTF-8?q?=EC=9D=8C=20|=20workflow=20=EB=82=B4=20test=20step=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20|=20=EC=A1=B0=EC=88=98=EB=B9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/develop_pull_request.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/develop_pull_request.yml b/.github/workflows/develop_pull_request.yml index 8ab4cd2..04fd787 100644 --- a/.github/workflows/develop_pull_request.yml +++ b/.github/workflows/develop_pull_request.yml @@ -33,9 +33,6 @@ jobs: - name: Install dependencies run: npm ci - - name: Test - run: npm test - - name: Build run: npm run build From c5e4c333de27d4da3a8aebe5dc87a4ce05ef6c56 Mon Sep 17 00:00:00 2001 From: Subin Cho Date: Fri, 25 Apr 2025 14:19:50 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore=20=20=20|=20sprint0=20|=20=EC=97=86?= =?UTF-8?q?=EC=9D=8C=20|=20workflow=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20|=20?= =?UTF-8?q?=EC=A1=B0=EC=88=98=EB=B9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 4a197c9..1ff60f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# Dockerfile for factoreal-FE + FROM node:18 WORKDIR /app