Files
tts_bot/melo-test/Dockerfile
Claude Owner 2bed5f38b7 fix(melo-test): unidic download is mandatory, not optional
User got past wheel build, then hit at startup:

  RuntimeError: Failed initializing MeCab
  [ifs] no such file or directory:
      .../site-packages/unidic/dicdir/mecabrc

Root cause: MeloTTS's text/cleaner.py unconditionally imports the
japanese module, which initializes MeCab.Tagger() at module load
time. So even Korean-only use needs the unidic dictionary data,
which is a separate ~250MB download.

- README: add explicit `python -m unidic download` step after
  pip install, and a troubleshooting entry for the mecabrc error.
- Dockerfile: run `python -m unidic download` during image build so
  the container is usable immediately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 20:45:24 +09:00

40 lines
1.2 KiB
Docker

# MeloTTS-Korean 테스트 서버 컨테이너.
# 호스트에 Python/MeCab/Rust 안 깔고 싶을 때 사용.
#
# 빌드: docker build -t melo-test .
# 실행: docker run --rm -p 7860:7860 melo-test
# (가중치 캐시 유지하려면: -v melo-cache:/root/.cache/huggingface)
FROM python:3.11-slim
# fugashi/mecab-python3 빌드용 MeCab + tokenizers 빌드용 Rust + 기본 빌드 툴
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
ca-certificates \
mecab \
libmecab-dev \
mecab-ipadic-utf8 \
&& rm -rf /var/lib/apt/lists/*
# Rust (tokenizers 소스 빌드 fallback 대비)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable --profile minimal
ENV PATH="/root/.cargo/bin:${PATH}"
WORKDIR /app
COPY requirements.txt .
RUN pip install --upgrade pip setuptools wheel \
&& pip install -r requirements.txt
# unidic 사전 데이터 (~250MB). MeloTTS 가 한국어만 써도 임포트 시점에
# 일본어 MeCab Tagger 를 무조건 초기화하므로 생략 불가.
RUN python -m unidic download
COPY . .
EXPOSE 7860
ENV PORT=7860
CMD ["python", "server.py"]