File size: 919 Bytes
8b1c497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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"]