# Modified Docker image for running WrentchPDF with proper asset handling FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_SERVER_PORT=7860 # Pillow needs libjpeg/zlib etc. Install runtime libs without extra cache. RUN apt-get update \ && apt-get install -y --no-install-recommends \ libjpeg62-turbo \ zlib1g \ libopenjp2-7 \ libtiff6 \ libwebp7 \ liblcms2-2 \ libfreetype6 \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt ./ RUN pip install -r requirements.txt # Copy project files but create empty assets directory COPY . . # Ensure assets directory exists and add a small placeholder favicon RUN mkdir -p /app/wrentchpdf/assets/ && \ echo -e "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\x04gAMA\x00\x00\xb1\x8f\x0b\xfca\x05\x00\x00\x00\tpHYs\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7o\xa8d\x00\x00\x00RIDAT8Oc\xf8\xff\xff?\x03%\x80\x89\x81B@\xb1\x01,\xd3\xa6M\xa3(\x04\xc8\xb6\x1a[\x08P\xcd\x00\\\xc1I.\x18u\xc1\xa8\x0bH\x03,\xd8\x82\x99\x9c\x10\xa0Z(\x8cZ\x80_\x80\x00\r\x88\x0c\t\\\x85d\x00\x00\x00\x00IEND\xaeB`\x82" > /app/wrentchpdf/assets/favicon.ico && \ cp /app/wrentchpdf/assets/favicon.ico /app/wrentchpdf/assets/favicon.png && \ echo -e "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\x04gAMA\x00\x00\xb1\x8f\x0b\xfca\x05\x00\x00\x00\tpHYs\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7o\xa8d\x00\x00\x00SIDATX\x85\xed\x97K\x0e\x000\x08\xc2h=\xff\xfd\xd7f\xb7j\x82?Z,\xc4\x05\x89\xbe\tS\n\x00\x8c\x91\x99\x01\x00\x02@\x97\xd8\x1d?\xc5\xce\xbb\x81Z\x05\x92k\xb7\xaf\xe0\xf5\x1f\xb8\x03E\xd2\x00\x07\xea\xdc\x8f\x9e\xf7\x1c\x10\x00\x02@\x00\x08\x00\x01x\x05\xf8\x00\x82\x8c!\xf9\x04F\x9e\x98\x00\x00\x00\x00IEND\xaeB`\x82" > /app/wrentchpdf/assets/screenshot.png EXPOSE 7860 CMD ["python", "app.py"]