FROM python:3.9-slim # Install required packages RUN apt-get update && apt-get install -y \ chromium \ chromium-driver \ fonts-dejavu \ libfontconfig1 \ && rm -rf /var/lib/apt/lists/* # Set environment variables for Fontconfig and Matplotlib ENV MPLCONFIGDIR=/tmp/matplotlib ENV FONTCONFIG_PATH=/etc/fonts ENV HOME=/root # Create Fontconfig cache directory and set permissions RUN mkdir -p /root/.cache/fontconfig && chmod -R 777 /root/.cache/fontconfig # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . /app WORKDIR /app # Generate Fontconfig cache RUN fc-cache -f -v # Run application CMD ["python", "app.py"]