From 68ff89bc7b37093d2b70e3e72d720eabab5daf3a Mon Sep 17 00:00:00 2001 From: hyoseong-Choi Date: Tue, 4 Feb 2025 16:42:12 +0900 Subject: [PATCH 1/3] =?UTF-8?q?:construction=5Fworker:=20[cicd]=20:=20?= =?UTF-8?q?=EB=8F=84=EC=BB=A4=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 41 ++++++++++++++-------------------------- .github/workflows/CI.yml | 4 ++-- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index f2822b95..2b4b598a 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -5,13 +5,13 @@ name: CD for front using github actions # develop 브랜치에 pull_request가 닫히거나 푸시했을때 실행 on: push: - branches: [ "develop" ] + branches: [ "CLAP-234" ] permissions: contents: read jobs: - front-cicd: + front-cd: runs-on: ubuntu-latest steps: # 저장소 코드를 체크아웃합니다. (PR 올린 코드를 가져오는 행위) @@ -31,26 +31,16 @@ jobs: - name: Build with npm run: npm run build-only - - name: send file via ssh - uses: appleboy/scp-action@v0.1.7 - with: - host: ${{ secrets.FRONT_HOST }} - username: ${{ secrets.FRONT_HOST_USERNAME }} - key: ${{ secrets.FRONT_HOST_KEY }} - port: ${{ secrets.FRONT_HOST_PORT }} - source: "dist/*" - target: /home/${{ secrets.FRONT_HOST_USERNAME }}/ -# -# - name: Create nginx.conf -# run: touch ./nginx.conf -# - run: echo "${{ secrets.NGINX_CONF }}" > ./nginx.conf + - name: Create nginx.conf + run: touch ./nginx.conf + - run: echo "${{ secrets.NGINX_CONF }}" > ./nginx.conf - ## docker build & push to production -# - name: Docker build & push -# run: | -# docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} -# docker build -t ${{ secrets.DOCKER_FRONT_REPO }} . -# docker push ${{ secrets.DOCKER_FRONT_REPO }} + # docker build & push to production + - name: Docker build & push + run: | + docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t ${{ secrets.DOCKER_FRONT_REPO }} . + docker push ${{ secrets.DOCKER_FRONT_REPO }} ## deploy - name: Deploy @@ -62,9 +52,6 @@ jobs: key: ${{ secrets.FRONT_HOST_KEY }} port: ${{ secrets.FRONT_HOST_PORT }} script: | - sudo rm -rf /var/www/html/* - sudo cp -r dist/* /var/www/html/ - sudo systemctl restart nginx -# docker rm -f taskflow-front -# docker image rm ${{ secrets.DOCKER_FRONT_REPO }} -f -# docker run --name taskflow-front -d -p 80:80 --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }} + docker rm -f taskflow-front + docker image rm ${{ secrets.DOCKER_FRONT_REPO }} -f + docker run --name taskflow-front -d -p 80:80 --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }} diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d68ac831..659c1578 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,13 +6,13 @@ name: CI for front using github actions on: pull_request: types: [ opened, synchronize ] - branches: [ "develop" ] + branches: [ "CLAP-234" ] permissions: contents: read jobs: - front-cicd: + front-ci: runs-on: ubuntu-latest steps: # 저장소 코드를 체크아웃합니다. (PR 올린 코드를 가져오는 행위) From 7d441b0947950df7662e53e405154612379ed338 Mon Sep 17 00:00:00 2001 From: hyoseong-Choi Date: Wed, 5 Feb 2025 15:19:39 +0900 Subject: [PATCH 2/3] =?UTF-8?q?:rocket:=20[cicd]=20:=20=EC=BB=A8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=84=88=EC=97=90=20tls=EC=9D=B8=EC=A6=9D=EC=84=9C=20?= =?UTF-8?q?=EB=B3=BC=EB=A5=A8=20=EB=A7=88=EC=9A=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 2 +- Dockerfile | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 2b4b598a..a8c2b284 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -54,4 +54,4 @@ jobs: script: | docker rm -f taskflow-front docker image rm ${{ secrets.DOCKER_FRONT_REPO }} -f - docker run --name taskflow-front -d -p 80:80 --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }} + docker run --name taskflow-front -d -p 80:80 -p 443:443 -v /etc/letsencrypt/:/etc/letsencrypt/ -v /etc/ssl/:/etc/ssl/ --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }} diff --git a/Dockerfile b/Dockerfile index cc43d25b..fa62b06b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM nginx COPY nginx.conf /etc/nginx/conf.d/default.conf COPY dist/. /usr/share/nginx/html/ -EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From 873a0608bb88d62cd9cbef352a3eefa1cd7b1f6e Mon Sep 17 00:00:00 2001 From: hyoseong-Choi Date: Wed, 5 Feb 2025 20:35:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?:rocket:=20[cicd]=20:=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=9C=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EB=94=94=EB=B2=A8=EB=A1=AD=20=EB=B8=8C=EB=9E=9C=EC=B9=98?= =?UTF-8?q?=EC=97=90=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 2 +- .github/workflows/CI.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index a8c2b284..df4b1f5e 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -5,7 +5,7 @@ name: CD for front using github actions # develop 브랜치에 pull_request가 닫히거나 푸시했을때 실행 on: push: - branches: [ "CLAP-234" ] + branches: [ "develop" ] permissions: contents: read diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 659c1578..c3aa7b09 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,7 +6,7 @@ name: CI for front using github actions on: pull_request: types: [ opened, synchronize ] - branches: [ "CLAP-234" ] + branches: [ "develop" ] permissions: contents: read