File size: 1,508 Bytes
d9f3ec6
9679fcd
 
 
e01702c
9679fcd
 
 
 
d9f3ec6
 
 
 
 
a2bed33
 
d9f3ec6
 
9679fcd
d9f3ec6
 
9679fcd
 
a2bed33
e01702c
 
 
d9f3ec6
 
 
 
a2bed33
e01702c
d9f3ec6
a2bed33
e01702c
 
d9f3ec6
a2bed33
 
d9f3ec6
a2bed33
d9f3ec6
9679fcd
 
 
d9f3ec6
9679fcd
d9f3ec6
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
46
47
48
49
50
FROM python:3.10-slim

WORKDIR /app

# System dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    git \
    git-lfs \
    ffmpeg \
    libsm6 \
    libxext6 \
    cmake \
    rsync \
    libgl1 \
    && rm -rf /var/lib/apt/lists/* \
    && git lfs install

# Copy requirements and source
COPY requirements.txt /tmp/requirements.txt
COPY src/ ./src/

# Deterministic install:
# - upgrade pip, setuptools, wheel
# - uninstall any possibly-preinstalled HF packages (no-op if absent)
# - install everything from requirements.txt in a single pip run
RUN python -m pip install --upgrade pip setuptools wheel \
    && pip uninstall -y huggingface-hub transformers sentence-transformers tokenizers datasets gradio spaces hf-transfer || true \
    && pip install --no-cache-dir --upgrade -r /tmp/requirements.txt

# DEBUG: print key versions into build log so you can confirm final state
# (keep this while debugging; remove later if you want smaller image)
RUN python - <<'PY'
import importlib
mods = ("huggingface_hub","transformers","sentence_transformers","datasets","tokenizers","torch")
for m in mods:
    try:
        mm = importlib.import_module(m)
        print(m, getattr(mm,'__version__', 'unknown'))
    except Exception as e:
        print(m, "import-failed:", e)
PY

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

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