From f3d68b2ef5e32f3b34367684e3b132ca0f62fc3a Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 13 Apr 2026 10:26:15 -0400 Subject: [PATCH] fix(docker): install markitdown directly in production stage The venv approach caused a Python version mismatch (3.11 in builder vs 3.13 in oven/bun:1-slim). Install markitdown with pip directly in the production stage using the runtime Python, then purge pip to keep image lean. Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e2131ad..d464b756 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,27 +26,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl xz-utils c && rm -rf /tmp/typst* \ && chmod +x /usr/local/bin/typst -# MarkItDown venv stage — Python + pip install markitdown -FROM debian:bookworm-slim AS markitdown -RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-venv \ - && python3 -m venv /opt/markitdown \ - && /opt/markitdown/bin/pip install --no-cache-dir markitdown \ - && rm -rf /var/lib/apt/lists/* - # Production stage FROM oven/bun:1-slim AS production WORKDIR /app -# Install CA certificates + python3 runtime (for markitdown) -RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates python3 && rm -rf /var/lib/apt/lists/* +# Install CA certificates + python3 + pip (for markitdown) +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates python3 python3-pip \ + && pip install --no-cache-dir --break-system-packages markitdown \ + && apt-get purge -y python3-pip && apt-get autoremove -y \ + && rm -rf /var/lib/apt/lists/* # Install Typst binary (for rPubs PDF generation) COPY --from=typst /usr/local/bin/typst /usr/local/bin/typst -# Install MarkItDown venv (for office document conversion) -COPY --from=markitdown /opt/markitdown /opt/markitdown -ENV PATH="/opt/markitdown/bin:$PATH" - # Copy built assets and server COPY --from=build /app/dist ./dist COPY --from=build /app/server ./server