# --- FINAL Dockerfile for RAG Project --- # Use a standard, lightweight Python image FROM python:3.10-slim # Set the working directory WORKDIR /app # Install ALL system dependencies in one go and clean up # This includes git, espeak-ng, and ffmpeg RUN apt-get update && apt-get install -y \ git \ espeak-ng \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Copy and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # Create a non-root user for better security RUN useradd --create-home appuser # Set the HOME environment variable for the new user # This ensures the model cache is written to a directory with correct permissions ENV HOME=/home/appuser # Switch to the non-root user USER appuser # Copy the application code and set correct ownership COPY --chown=appuser:appuser . . # Expose the port Gradio will run on EXPOSE 7860 # The command to run the application CMD ["python", "app.py"]