File size: 1,098 Bytes
299dbef
 
 
 
3770496
8343353
 
3770496
299dbef
3770496
 
 
299dbef
8343353
3770496
 
 
299dbef
8343353
3770496
 
 
8343353
3770496
 
 
8343353
3770496
 
299dbef
8343353
3770496
299dbef
8343353
3770496
 
8343353
 
 
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
FROM python:3.9-slim

WORKDIR /app

# Install system tools
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc python3-dev curl && \
    rm -rf /var/lib/apt/lists/*

# Create folders for models and configs
RUN mkdir -p /app/models /app/huggingface /tmp/.streamlit && \
    chmod 777 /app/models /app/huggingface /tmp/.streamlit

# Set environment variables
ENV TRANSFORMERS_CACHE=/app/models
ENV HF_HOME=/app/huggingface
ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit

# Streamlit config (fix for Hugging Face 403 upload error)
RUN echo "[server]\n\
enableCORS = false\n\
enableXsrfProtection = false\n\
fileWatcherType = 'none'\n\
[browser]\n\
gatherUsageStats = false\n" > /tmp/.streamlit/config.toml

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

# Copy application code
COPY app.py .

# Health check and expose port
EXPOSE 8501
HEALTHCHECK --interval=30s --timeout=5s CMD curl -f http://localhost:8501/_stcore/health

# Run the app
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]