File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,18 @@ COPY embedder_service/requirements.txt .
1111
1212RUN pip install --no-cache-dir -r requirements.txt
1313
14+ # Allow model to be configured at build time
15+ ARG EMBEDDING_MODEL="all-MiniLM-L6-v2"
16+ ENV EMBEDDING_MODEL=${EMBEDDING_MODEL}
17+
18+ # Set a predictable cache directory for sentence-transformers models
19+ ENV SENTENCE_TRANSFORMERS_HOME=/opt/models_cache
20+
21+ # Pre-download the sentence transformers model to avoid runtime download and cache permission issues
22+ RUN echo 'import os\n from sentence_transformers import SentenceTransformer\n SentenceTransformer(os.environ["EMBEDDING_MODEL"])' > download_model.py && \
23+ python download_model.py && \
24+ rm download_model.py
25+
1426# Copy utils folder from root context into /app/utils
1527COPY shared_utils ./shared_utils
1628
You can’t perform that action at this time.
0 commit comments