| # Use the official Python image | |
| FROM python:3.12-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Create the data directory and change its ownership | |
| # Hugging Face Spaces run as the 'user' (uid 1000) | |
| RUN mkdir -p /app/data && chown -R 1000:1000 /app/data | |
| WORKDIR /app | |
| # Expose the port the app runs on | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "main.py"] |