From d97f08d866d20e9d5b1da83c92b3e638d6cd3f6c Mon Sep 17 00:00:00 2001 From: kakusiA Date: Thu, 25 Sep 2025 15:23:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20mecab=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/pre-processing-service/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/pre-processing-service/Dockerfile b/apps/pre-processing-service/Dockerfile index 6ecb09c8..f2d2b02d 100644 --- a/apps/pre-processing-service/Dockerfile +++ b/apps/pre-processing-service/Dockerfile @@ -49,7 +49,8 @@ RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd6 RUN apt-get update && apt-get install -y --no-install-recommends \ mecab \ libmecab-dev \ - mecab-ipadic-utf8 \ + mecab-ko \ + mecab-ko-dic \ && rm -rf /var/lib/apt/lists/* # /opt/venv 복사 From 1351bc0a2d1e56615f03e28f113235635fc2da45 Mon Sep 17 00:00:00 2001 From: kakusiA Date: Thu, 25 Sep 2025 16:36:59 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:mecab=20=EC=84=A4=EC=A0=95=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/pre-processing-service/Dockerfile | 18 ++++++++++++------ .../app/utils/keyword_matcher.py | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/pre-processing-service/Dockerfile b/apps/pre-processing-service/Dockerfile index f2d2b02d..13af476a 100644 --- a/apps/pre-processing-service/Dockerfile +++ b/apps/pre-processing-service/Dockerfile @@ -49,10 +49,20 @@ RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd6 RUN apt-get update && apt-get install -y --no-install-recommends \ mecab \ libmecab-dev \ - mecab-ko \ - mecab-ko-dic \ + wget \ + build-essential \ && rm -rf /var/lib/apt/lists/* +# 한국어 사전 수동 설치 +RUN cd /tmp && \ + wget https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.1.1-20180720.tar.gz && \ + tar -zxf mecab-ko-dic-2.1.1-20180720.tar.gz && \ + cd mecab-ko-dic-2.1.1-20180720 && \ + ./configure && \ + make && \ + make install && \ + cd / && rm -rf /tmp/mecab-ko-dic-* + # /opt/venv 복사 COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" @@ -60,9 +70,5 @@ ENV PATH="/opt/venv/bin:$PATH" # 앱 소스 COPY . . - -# 환경변수로 MeCab 경로 지정 -ENV MECAB_PATH=/usr/lib/mecab/dic/ipadic - # (권장 대안) 코드에서 uvicorn import 안 하고 프로세스 매니저로 실행하려면: ENTRYPOINT ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "app.main:app", "-b", "0.0.0.0:8000", "--timeout", "120"] \ No newline at end of file diff --git a/apps/pre-processing-service/app/utils/keyword_matcher.py b/apps/pre-processing-service/app/utils/keyword_matcher.py index 6806b140..734cc424 100644 --- a/apps/pre-processing-service/app/utils/keyword_matcher.py +++ b/apps/pre-processing-service/app/utils/keyword_matcher.py @@ -22,6 +22,7 @@ def __init__(self): if MECAB_AVAILABLE: try: # 환경변수 MECAB_PATH가 있으면 사용, 없으면 기본값 + os.environ['MECABRC'] = os.getenv('MECABRC') mecab_path = os.getenv("MECAB_PATH") if mecab_path: self.mecab = MeCab.Tagger(f"-d {mecab_path}") From d7e912a566d85bcf2e415d26ed500336ae8ef9cc Mon Sep 17 00:00:00 2001 From: kakusiA Date: Thu, 25 Sep 2025 16:38:09 +0900 Subject: [PATCH 3/4] =?UTF-8?q?style:=20code=20=ED=8F=AC=EB=A9=A7=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/pre-processing-service/app/utils/keyword_matcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/pre-processing-service/app/utils/keyword_matcher.py b/apps/pre-processing-service/app/utils/keyword_matcher.py index 734cc424..3cb5f0b3 100644 --- a/apps/pre-processing-service/app/utils/keyword_matcher.py +++ b/apps/pre-processing-service/app/utils/keyword_matcher.py @@ -22,7 +22,7 @@ def __init__(self): if MECAB_AVAILABLE: try: # 환경변수 MECAB_PATH가 있으면 사용, 없으면 기본값 - os.environ['MECABRC'] = os.getenv('MECABRC') + os.environ["MECABRC"] = os.getenv("MECABRC") mecab_path = os.getenv("MECAB_PATH") if mecab_path: self.mecab = MeCab.Tagger(f"-d {mecab_path}") From abddcc3a593e72a0648aa5ce89ffa4648e6f320d Mon Sep 17 00:00:00 2001 From: kakusiA Date: Thu, 25 Sep 2025 16:39:52 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:FAST=20API=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-fastapi.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-fastapi.yml b/.github/workflows/deploy-fastapi.yml index 6a8b26ba..a05caa39 100644 --- a/.github/workflows/deploy-fastapi.yml +++ b/.github/workflows/deploy-fastapi.yml @@ -42,6 +42,8 @@ jobs: echo "S3_UPLOAD_ENABLED=${{ secrets.S3_UPLOAD_ENABLED }}" >> .env.prod echo "IMAGE_DOWNLOAD_TIMEOUT=${{ secrets.IMAGE_DOWNLOAD_TIMEOUT }}" >> .env.prod echo "MAX_IMAGE_SIZE_MB=${{ secrets.MAX_IMAGE_SIZE_MB }}" >> .env.prod + echo "MECAB_PATH=${{ secrets.MECAB_PATH }}" >> .env.prod + echo "MECABRC=${{ secrets.MECABRC }}" >> .env.prod - name: Set repo lowercase run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV