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 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-04-13 10:26:15 -04:00
parent 698a630b8b
commit f3d68b2ef5
1 changed files with 5 additions and 13 deletions

View File

@ -26,27 +26,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl xz-utils c
&& rm -rf /tmp/typst* \ && rm -rf /tmp/typst* \
&& chmod +x /usr/local/bin/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 # Production stage
FROM oven/bun:1-slim AS production FROM oven/bun:1-slim AS production
WORKDIR /app WORKDIR /app
# Install CA certificates + python3 runtime (for markitdown) # Install CA certificates + python3 + pip (for markitdown)
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates python3 && rm -rf /var/lib/apt/lists/* 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) # Install Typst binary (for rPubs PDF generation)
COPY --from=typst /usr/local/bin/typst /usr/local/bin/typst 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 built assets and server
COPY --from=build /app/dist ./dist COPY --from=build /app/dist ./dist
COPY --from=build /app/server ./server COPY --from=build /app/server ./server