File size: 1,244 Bytes
400fe06
66530af
f69762d
4044657
f69762d
 
6c93c90
 
 
 
f69762d
 
 
 
66530af
 
 
 
 
 
 
 
 
 
 
 
 
a554343
828b3d4
 
66530af
b251401
 
66530af
 
 
6c93c90
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
FROM python:3.12.7

# Set environment
#ENV HOME=/root
ENV TRANSFORMERS_CACHE=/app/cache
ENV HF_HOME=/app/cache
# Set environment variables
ENV STREAMLIT_WATCHER_TYPE=none \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

# Create writable cache
RUN mkdir -p /app/cache

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    git \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt ./
COPY src/ ./src/

RUN pip3 install -r requirements.txt
RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('setu4993/LaBSE')"
# Preload sentence-transformers model into cache
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('intfloat/multilingual-e5-small')"

# Download the model at build time (preload it into cache)
RUN python3 -c "from transformers import pipeline; pipeline('question-answering', model='deepset/xlm-roberta-base-squad2')"
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0","--server.enableCORS=false","--server.enableXsrfProtection=false"]