Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies (if any needed for Pillow) | |
| # libjpeg-dev zlib1g-dev are usually included in slim or wheels handle it, | |
| # but good to be safe if we were building from source. | |
| # For standard Pillow wheels, slim is fine. | |
| # We might need fonts for watermark if we want better than default. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| fonts-dejavu-core \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements | |
| COPY requirements.txt . | |
| # Install python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create a non-root user (mandatory for HF Spaces) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Expose the port | |
| EXPOSE 7860 | |
| # Command to run the app using Gunicorn | |
| CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"] | |