File size: 1,329 Bytes
f473b17
 
a2ed2c5
da19753
b47756a
59898a2
20dafbe
59898a2
 
 
 
 
20dafbe
 
59898a2
 
 
 
 
 
b544ce2
 
f473b17
59898a2
 
 
 
 
 
 
 
 
 
 
b47756a
f10b6d1
59898a2
b47756a
138f148
59898a2
b47756a
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
41
42
FROM python:3.9-slim

# Set working directory
WORKDIR /app

# Avoid Hugging Face permission warnings and force CPU
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=$HF_HOME
ENV HF_DATASETS_CACHE=$HF_HOME/datasets
ENV HF_METRICS_CACHE=$HF_HOME/metrics

# Create and set permission to the cache folder
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# βœ… Download required models into cache (CPU-compatible)
RUN python -c "from transformers import pipeline; \
    pipeline('summarization', model='sshleifer/distilbart-cnn-12-6'); \
    pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english'); \
    pipeline('text-classification', model='mrm8488/bert-tiny-finetuned-fake-news-detection')"

# βœ… Download sentence transformer for FAISS
RUN python -c "from sentence_transformers import SentenceTransformer; \
    SentenceTransformer('all-MiniLM-L6-v2')"

# Copy full app source
COPY . .

# Expose Streamlit default port
EXPOSE 7860

# Start Streamlit app from src/
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]