File size: 913 Bytes
8b6fc74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# ============================================================
# Image Compressor Pro — Python Backend (HuggingFace Spaces)
# ============================================================
FROM python:3.11-slim

# System dependencies for Pillow and pillow-heif
RUN apt-get update && apt-get install -y --no-install-recommends \
    libheif-dev \
    libavif-dev \
    libjpeg-turbo-progs \
    libjpeg62-turbo-dev \
    libwebp-dev \
    libtiff-dev \
    libffi-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies first (Docker layer caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY app.py .

# HuggingFace Spaces expects port 7860
EXPOSE 7860

# Production: use multiple workers for concurrency
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "4", "--log-level", "info"]