2024-12-27 13:56:32 +00:00
|
|
|
# FFmpeg stage
|
|
|
|
|
FROM jrottenberg/ffmpeg:4.1-scratch AS ffmpeg
|
2024-12-16 12:08:15 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
# Development stage
|
|
|
|
|
FROM python:3.13-bullseye AS development
|
2024-12-16 12:08:15 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
COPY --from=ffmpeg / /
|
2024-12-21 02:09:17 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
|
|
|
PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
|
|
|
|
|
# Install build dependencies
|
2024-12-17 02:15:16 +00:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2024-12-27 13:56:32 +00:00
|
|
|
build-essential \
|
|
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2024-12-16 12:08:15 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
RUN pip install --no-cache-dir hatch
|
2024-12-16 12:08:15 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY . /app/
|
|
|
|
|
|
|
|
|
|
# Build stage
|
|
|
|
|
FROM python:3.13-bullseye AS build
|
|
|
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
build-essential \
|
|
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir hatch
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY pyproject.toml /app/
|
|
|
|
|
COPY . /app/
|
2024-12-16 12:11:13 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
RUN hatch build
|
|
|
|
|
|
|
|
|
|
# Production stage
|
|
|
|
|
FROM python:3.13-slim-bullseye AS production
|
|
|
|
|
|
|
|
|
|
# Copy ffmpeg binaries
|
|
|
|
|
COPY --from=ffmpeg / /
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY --from=build /app/dist /tmp/dist
|
|
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir /tmp/dist/markitdown-*.whl
|
|
|
|
|
|
|
|
|
|
# Default USERID and GROUPID
|
|
|
|
|
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
|
|
|
|
USER appuser
|
2024-12-16 12:08:15 +00:00
|
|
|
|
2024-12-27 13:56:32 +00:00
|
|
|
# Entrypoint
|
|
|
|
|
ENTRYPOINT ["markitdown"]
|