From 6e75a4dfbd3d81aa65d2cd0223bd502814d57ce6 Mon Sep 17 00:00:00 2001 From: yuhojae Date: Tue, 8 Apr 2025 13:56:36 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=B0=B0=ED=8F=AC=20=EC=9A=B4=EC=98=81?= =?UTF-8?q?=ED=99=98=EA=B2=BD=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d910ff..fd4b2a7 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "vite build --mode production", "lint": "eslint .", "preview": "vite preview", - "start": "vite --port 3000" + "start": "vite --port 3000 --mode production" }, "dependencies": { "@tailwindcss/vite": "^4.0.3", From f0f2904ee416d5eb5c6dd7a742ad7ff2246e15d2 Mon Sep 17 00:00:00 2001 From: yuhojae Date: Tue, 8 Apr 2025 14:01:58 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EB=B9=8C=EB=93=9C=EB=AA=85=EB=A0=B9?= =?UTF-8?q?=EC=96=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d42c5d..e2aa423 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: echo "VITE_GA_MEASUREMENT_ID=${{ secrets.VITE_GA_MEASUREMENT_ID }}" > .env - name: Run build - run: npm run build --mode production --verbose # 프로젝트에 맞는 빌드 명령어 + run: npm run build # 프로젝트에 맞는 빌드 명령어 - name: Docker build & push run: | From 850eb162b4c945cd3da14351ce440999cc23f6e0 Mon Sep 17 00:00:00 2001 From: yuhojae Date: Tue, 8 Apr 2025 14:07:59 +0900 Subject: [PATCH 3/3] =?UTF-8?q?ci=20=ED=8C=8C=EC=9D=BC=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 41 +++++------------------------- .github/workflows/cicd.yml | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e2aa423..85d10da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,9 @@ -name: 빌드 자동화 - +name: 빌드 자동화 + on: push: branches: - - main - - feat/cicd + - dev jobs: build: @@ -14,39 +13,13 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Node.js (언어 환경) + - name: Set up Node.js (또는 다른 언어 환경) uses: actions/setup-node@v2 with: - node-version: "20" + node-version: '20' - name: Install dependencies - run: | - npm install - npm install tailwindcss@latest postcss@latest autoprefixer@latest - npm install --save-dev @types/node - - - name: Create .env file # env 파일 생성 단계 추가 - run: | - echo "VITE_GA_MEASUREMENT_ID=${{ secrets.VITE_GA_MEASUREMENT_ID }}" > .env + run: npm install - name: Run build - run: npm run build # 프로젝트에 맞는 빌드 명령어 - - - name: Docker build & push - run: | - docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - docker build -t ${{ secrets.DOCKER_USERNAME }}/embitips_front . - docker push ${{ secrets.DOCKER_USERNAME }}/embitips_front - - - name: Deploy to GCP - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.HOST_PROD }} - username: ${{ secrets.USERNAME }} - key: ${{ secrets.PRIVATE_KEY }} - script: | - sudo docker stop embitips_front || true - sudo docker rm embitips_front || true - sudo docker pull ${{ secrets.DOCKER_USERNAME }}/embitips_front - sudo docker run -d -p 3000:3000 --name embitips_front ${{ secrets.DOCKER_USERNAME }}/embitips_front - sudo docker image prune -f + run: npm run build \ No newline at end of file diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..e2aa423 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,52 @@ +name: 빌드 자동화 + +on: + push: + branches: + - main + - feat/cicd + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js (언어 환경) + uses: actions/setup-node@v2 + with: + node-version: "20" + + - name: Install dependencies + run: | + npm install + npm install tailwindcss@latest postcss@latest autoprefixer@latest + npm install --save-dev @types/node + + - name: Create .env file # env 파일 생성 단계 추가 + run: | + echo "VITE_GA_MEASUREMENT_ID=${{ secrets.VITE_GA_MEASUREMENT_ID }}" > .env + + - name: Run build + run: npm run build # 프로젝트에 맞는 빌드 명령어 + + - name: Docker build & push + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t ${{ secrets.DOCKER_USERNAME }}/embitips_front . + docker push ${{ secrets.DOCKER_USERNAME }}/embitips_front + + - name: Deploy to GCP + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.PRIVATE_KEY }} + script: | + sudo docker stop embitips_front || true + sudo docker rm embitips_front || true + sudo docker pull ${{ secrets.DOCKER_USERNAME }}/embitips_front + sudo docker run -d -p 3000:3000 --name embitips_front ${{ secrets.DOCKER_USERNAME }}/embitips_front + sudo docker image prune -f