File size: 1,073 Bytes
009efa1
59705f1
 
 
c6246b4
009efa1
 
 
 
49d2021
009efa1
 
c6246b4
009efa1
c6246b4
 
 
 
49d2021
c6246b4
 
 
939b1d5
c6246b4
 
 
49d2021
c6246b4
49d2021
c6246b4
59705f1
939b1d5
009efa1
 
c6246b4
968023b
 
59705f1
968023b
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
FROM python:3.10-slim

WORKDIR /app

# 1. Install essential system dependencies
RUN apt-get update && apt-get install -y \
    gcc \
    python3-dev \
    libgomp1 \
    libopenblas-dev \
    && rm -rf /var/lib/apt/lists/*

# 2. First install only absolutely critical packages
RUN pip install --upgrade pip && \
    pip install --no-cache-dir \
    spacy==3.7.4 \
    nltk==3.8.1 \
    python-dotenv==1.0.0

# 3. Download NLP models (done before other installs to prevent conflicts)
RUN python -m spacy download en_core_web_sm && \
    python -m nltk.downloader punkt wordnet

# 4. Install PyTorch CPU version explicitly
RUN pip install --no-cache-dir \
    torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu

# 5. Install remaining requirements in one go to minimize layers
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 6. Copy application files
COPY . .

# 7. Environment configuration
ENV STREAMLIT_SERVER_PORT=7860
EXPOSE 7860

CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]