From 3e7d7ce2fb369d12a8cd24812e03979b6ff2f43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9B=90=EC=B0=AC?= Date: Mon, 4 Mar 2024 22:17:07 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[chore]=20docker=20build=20cache=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=ED=95=98=EC=97=AC=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EB=B9=A0=EB=A5=B4=EA=B2=8C=20=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 910bc6d..2e150d5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,9 +18,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Create new builder - run: docker buildx create --use --name mybuilder --driver docker-container - - name: Docker login uses: docker/login-action@v1 with: @@ -34,7 +31,8 @@ jobs: file: ./Dockerfile push: true tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:${{ github.event.pull_request.number }}, ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest - platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max - name: Deploy to EC2 uses: appleboy/ssh-action@master @@ -44,10 +42,8 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} script: | sudo sh -c 'truncate -s 0 /var/lib/docker/containers/*/*-json.log' - cd /${{ secrets.REPOSITORY_NAME }} + cd ~/${{ secrets.REPOSITORY_NAME }} sudo echo "${{ secrets.DOT_ENT }}" > .env sudo docker rm -f ${{ secrets.REPOSITORY_NAME }} || true sudo docker rmi -f ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest || true - sudo docker run -d --name ${{ secrets.REPOSITORY_NAME }} -p 8001:8000 --env-file .env ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest - - sudo docker exec -it ${{ secrets.REPOSITORY_NAME }} python3 manage.py migrate \ No newline at end of file + sudo docker run -d --name ${{ secrets.REPOSITORY_NAME }} -p 8001:8000 --env-file .env ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest \ No newline at end of file From 3dd396f1e056f77fd3a83ddfe6555bd5fe330e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9B=90=EC=B0=AC?= Date: Mon, 4 Mar 2024 22:36:46 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[chore]=20base=20image=20latest=20=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= 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 2386dfd..1bbfaca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM twoone14/dp-base-image:0.2 +FROM twoone14/dp-base-image:latest WORKDIR /app From 37f80927c1e49fff7724b0072b54797ca64717c4 Mon Sep 17 00:00:00 2001 From: rvbear Date: Mon, 4 Mar 2024 22:43:56 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[feat]=20han=5Fspell=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=20=EB=B0=8F=20=EB=B6=88=EC=9A=A9=EC=96=B4=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diary/textrank.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/diary/textrank.py b/diary/textrank.py index 13f0ab1..9876e85 100644 --- a/diary/textrank.py +++ b/diary/textrank.py @@ -1,6 +1,5 @@ import re import numpy as np -from hanspell import spell_checker from konlpy.tag import Okt from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer @@ -23,7 +22,7 @@ def sent_normalize(self, sentence): sentence = re.sub(pattern=self.signpattern, repl=self.repl, string=sentence) # 맞춤법 수정 - return spell_checker.check(sentence).checked + return sentence class SentenceTokenizer: @@ -52,9 +51,12 @@ def get_nouns(sentences): okt = Okt() + stopword = ["오늘", "내일", "빨리", "바쁘게"] + # 명사 추출후 명사 리스트를 문자열로 변환하는 함수 def join_nouns(sentence): - return ' '.join(okt.nouns(str(sentence))) + return ' '.join([noun for noun in okt.nouns(str(sentence)) + if noun not in stopword]) # 명사 추출 return list(map(join_nouns, sentences)) From 5330c5e1dea35dd0c42aee31959cda4d7e0d6ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9B=90=EC=B0=AC?= Date: Tue, 5 Mar 2024 11:19:16 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[chore]=20hotfix=20workflow=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/hotfix.yml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/hotfix.yml diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml new file mode 100644 index 0000000..f22cd91 --- /dev/null +++ b/.github/workflows/hotfix.yml @@ -0,0 +1,50 @@ +name: Build And Deploy + +on: + push: + branches: + - main + +jobs: + hotfix: + # push 이벤트가 발생했을 때만 실행 + if: github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Docker login + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker Build and Push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Deploy to EC2 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ubuntu + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + sudo sh -c 'truncate -s 0 /var/lib/docker/containers/*/*-json.log' + cd ~/${{ secrets.REPOSITORY_NAME }} + sudo echo "${{ secrets.DOT_ENT }}" > .env + sudo docker rm -f ${{ secrets.REPOSITORY_NAME }} || true + sudo docker rmi -f ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest || true + sudo docker run -d --name ${{ secrets.REPOSITORY_NAME }} -p 8001:8000 --env-file .env ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest + + sudo docker exec ${{ secrets.REPOSITORY_NAME }} python3 manage.py migrate \ No newline at end of file From 31f6c757a3465543e825d01e9aa69d60d53ff549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9B=90=EC=B0=AC?= Date: Tue, 5 Mar 2024 15:01:13 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[chore]=20docker=20compose=20=EB=A1=9C=20?= =?UTF-8?q?=EC=8B=A4=ED=96=89=EB=90=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2e150d5..bcf1fd5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,4 +46,4 @@ jobs: sudo echo "${{ secrets.DOT_ENT }}" > .env sudo docker rm -f ${{ secrets.REPOSITORY_NAME }} || true sudo docker rmi -f ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest || true - sudo docker run -d --name ${{ secrets.REPOSITORY_NAME }} -p 8001:8000 --env-file .env ${{ secrets.DOCKER_USERNAME }}/${{ secrets.REPOSITORY_NAME }}:latest \ No newline at end of file + sudo docker-compose up -d \ No newline at end of file