File size: 1,258 Bytes
f6e78ca
18f8d47
fde8aa4
bb0a339
 
 
 
fde8aa4
74574b0
fde8aa4
 
 
 
 
 
74574b0
 
 
fde8aa4
 
18f8d47
fde8aa4
bb0a339
fde8aa4
2e55c4c
ccc1a91
f6e78ca
76e2de3
 
ccc1a91
76e2de3
74574b0
d9b08a5
5232e60
ccc1a91
74574b0
ccc1a91
 
d9b08a5
 
fde8aa4
76e2de3
f6e78ca
87831b8
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
43
44
45
FROM python:3.10-slim

# 1) Install git (for any VCS-based deps) + clean up
RUN apt-get update \
 && apt-get install -y --no-install-recommends git \
 && rm -rf /var/lib/apt/lists/*

# 2) Set HF & numba cache + runtime ENVs
# Use correct model ID casing to match HF repo
ENV HF_HOME=/tmp/hfcache \
    TRANSFORMERS_CACHE=/tmp/hfcache \
    SENTENCE_TRANSFORMERS_HOME=/tmp/hfcache \
    NUMBA_CACHE_DIR=/tmp/numba_cache \
    PIP_NO_CACHE_DIR=1 \
    PYTHONUNBUFFERED=1 \
    EMBED_MODEL=Seznam/simcse-small-e-czech \
    MIN_TOPIC_SIZE=10 \
    MAX_DOCS=5000 \
    MIN_TOPIC_SIZE=10 \
    MAX_DOCS=5000

# 3) Create cache folders & open permissions
RUN mkdir -p /tmp/hfcache /tmp/numba_cache \
 && chmod -R a+rwX /tmp/hfcache /tmp/numba_cache

# 4) Copy & install Python deps
WORKDIR /code
COPY requirements.txt .
RUN pip install --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt

# 5) Pre-download your Czech SBERT into that cache using correct casing
RUN python - <<'PY'
from sentence_transformers import SentenceTransformer
SentenceTransformer(
    'Seznam/simcse-small-e-czech',
    cache_folder='/tmp/hfcache'
)
PY

# 6) Copy in your app & run
COPY app.py .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]