|
|
FROM python:3.10-slim |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
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.txt /tmp/requirements.txt |
|
|
COPY src/ ./src/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
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"] |
|
|
|