# Dockerfile FROM python:3.10-slim # --- START CACHE BUSTER --- # This command forces the build system to re-run the subsequent installation step. RUN echo "Forcing a fresh install of unoconv dependencies." # --- END CACHE BUSTER --- # IMPORTANT: Install System Dependencies as the root user first. # This step MUST come before switching to the 'user' account. RUN apt-get update && \ apt-get install -y \ libreoffice \ unoconv \ python3-uno \ locales \ # Add a dummy package here, if necessary, to break cache again, e.g., 'ca-certificates' && \ rm -rf /var/lib/apt/lists/* # Set up a non-root user (Standard Hugging Face practice) RUN useradd -m -u 1000 user ENV HOME=/home/user USER user # Set working directory for the user WORKDIR /home/user/app # Install Python dependencies from requirements.txt (must only contain 'gradio') COPY requirements.txt /home/user/app/ RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY app.py /home/user/app/ # Set the entry point for Gradio ENV GRADIO_SERVER_PORT 7860 EXPOSE 7860 CMD ["python3", "app.py"]