docker/embeddings.Dockerfile aktualisiert
Some checks failed
Deploy mindnet to llm-node / deploy (push) Failing after 2s

This commit is contained in:
Lars 2025-09-04 08:00:52 +02:00
parent 3fb93c2ccc
commit 4ff908823e

View File

@ -1,29 +1,41 @@
FROM python:3.11-slim FROM python:3.11-slim
ENV TRANSFORMERS_CACHE=/srv/.hf_cache \ ENV HF_HOME=/srv/.hf_cache \
TRANSFORMERS_CACHE=/srv/.hf_cache \
HF_HUB_DISABLE_TELEMETRY=1 \ HF_HUB_DISABLE_TELEMETRY=1 \
PIP_NO_CACHE_DIR=1 \ PIP_NO_CACHE_DIR=1 \
PYTHONUNBUFFERED=1 PYTHONUNBUFFERED=1 \
OMP_NUM_THREADS=1
# Minimal nötige Systemlibs für numpy/scipy/sklearn/torch # Runtime-Libs für NumPy/SciPy/Sklearn/Torch
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 libstdc++6 libgfortran5 ca-certificates wget && \ libgomp1 libstdc++6 libgfortran5 ca-certificates wget && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
WORKDIR /srv WORKDIR /srv
# CPU-Torch fest (kein CUDA, kleine Wheels) # 1) Pip & feste Numerik/Torch (CPU)
RUN python -m pip install --upgrade pip && \ RUN python -m pip install --upgrade pip && \
pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu "torch==2.2.2" pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu "torch==2.2.2" && \
pip install --no-cache-dir "numpy==1.26.4" "scipy==1.11.4" "scikit-learn==1.3.2"
# Satztransformer + Uvicorn/FastAPI # 2) App-Dependencies (ziehen KEIN numpy-Upgrade mehr)
RUN pip install --no-cache-dir \ RUN pip install --no-cache-dir \
fastapi==0.111.0 \ fastapi==0.111.0 \
uvicorn[standard]==0.30.1 \ uvicorn[standard]==0.30.1 \
sentence-transformers==3.0.1 sentence-transformers==3.0.1
# App rein # 3) App-Code
COPY ../app/embed_server.py /srv/embed_server.py COPY ../app/embed_server.py /srv/embed_server.py
# 4) Build-Time-Sanity-Check (bricht Build ab, falls was nicht stimmt)
RUN python - <<'PY'
from sentence_transformers import SentenceTransformer
m = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
e = m.encode(["ping","hallo welt"], normalize_embeddings=False)
assert len(e)==2 and len(e[0])==384, "embedding shape mismatch"
print("Sanity OK: shape", len(e), len(e[0]))
PY
EXPOSE 8990 EXPOSE 8990
CMD ["uvicorn", "embed_server:app", "--host", "0.0.0.0", "--port", "8990"] CMD ["uvicorn", "embed_server:app", "--host", "0.0.0.0", "--port", "8990"]