File size: 1,071 Bytes
f00b2ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
# Dockerfile
# Targets Hugging Face Docker Spaces — port 7860 is required by HF.
# Health-check endpoint runs on :8080 (see app.py) for UptimeRobot / HF pings.

FROM python:3.11-slim

WORKDIR /app

# System deps for numpy/torch/hdbscan build wheels + newspaper3k
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    libxml2-dev \
    libxslt-dev \
    libffi-dev \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install Python deps before copying source (Docker layer cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Download NLTK data needed by newspaper3k
RUN python -c "import nltk; nltk.download('punkt'); nltk.download('punkt_tab')"

# Copy source
COPY . .

# Create cache directory (pipeline.py writes here)
RUN mkdir -p cache

# HF Spaces requires port 7860
EXPOSE 7860

CMD ["streamlit", "run", "app.py", \
     "--server.port=7860", \
     "--server.address=0.0.0.0", \
     "--server.headless=true", \
     "--server.enableCORS=false", \
     "--server.enableXsrfProtection=false"]