Skip to content

Commit 41620f8

Browse files
torrid-fishclaude
andcommitted
fix(docker): download UniDic dict at build to fix MarkAccent 500
The `unidic` pip package ships the loader but not the ~770MB dicdir, so fugashi.Tagger() failed at runtime (missing mecabrc) and /api/MarkAccent/ returned 500. Run `unidic download` in the builder stage; the venv copy into the final image carries the dict along. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0dae8fb commit 41620f8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ COPY pyproject.toml uv.lock ./
1111
# Install dependencies using uv
1212
RUN uv sync --frozen --no-dev --no-install-project
1313

14+
# Download the full UniDic 3.1.0 dictionary body (~770MB) into the venv so
15+
# the image is self-contained — the `unidic` pip package ships the loader
16+
# but not the dicdir, and fugashi.Tagger() fails at runtime without it.
17+
# Kept as its own layer (before COPY . .) so app-code edits don't bust the
18+
# download cache; only re-runs when uv.lock / the unidic version changes.
19+
RUN .venv/bin/python -m unidic download
20+
1421
COPY . .
1522

1623
# Compile only our app code (skip .venv) and drop the .py sources

0 commit comments

Comments
 (0)