FROM python:3.9-slim RUN apt-get update && apt-get install -y gcc ghostscript pdftohtml imagemagick parallel python3-dev python3-pip libxml2-dev build-essential python3-dev python3-distutils libxslt1-dev zlib1g-dev g++ COPY requirements.txt . # Set environment variables for Matplotlib and Fontconfig ENV MPLCONFIGDIR=/tmp/matplotlib_config ENV XDG_CACHE_HOME=/tmp/cache # Create writable directories RUN mkdir -p /tmp/matplotlib_config /tmp/cache/fontconfig && \ chmod -R 777 /tmp/matplotlib_config /tmp/cache RUN pip install --upgrade pip setuptools wheel RUN pip install numpy==1.19.3 RUN pip install --no-cache-dir -r requirements.txt --upgrade RUN pip install numpy==1.23.4 COPY app app/ RUN python app/server.py EXPOSE 5042 CMD ["python", "app/server.py", "serve"]