# Use the full Python 3.10 image
FROM python:3.10-slim

# Set the working directory inside the container
WORKDIR /app

# Install system dependencies and clean up cache in one layer
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libglib2.0-dev \
    libsm6 \
    libxext6 \
    libxrender1 \
    libcairo2 \
    libjpeg62-turbo \
    libopenjp2-7 \
    libpng-dev \
    zlib1g-dev \
    libtiff-dev \
    libharfbuzz0b \
    libpango1.0-0 \
    libmagic1 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN pip install --upgrade pip

# install magic-pdf
RUN pip install -U magic-pdf[full] --extra-index-url https://wheels.myhloli.com -i https://pypi.tuna.tsinghua.edu.cn/simple && rm -rf /root/.cache/pip

CMD ["/bin/bash"]