Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(api): bundle spaCy en_core_web_sm in the api image (#43601)

Dan Brimaa8541100107d
diff --git a/api/Dockerfile b/api/Dockerfile
index 7c9b5d1a158..bc98ec62584 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -107,6 +107,10 @@ ENV TIKTOKEN_CACHE_DIR=/app/api/.tiktoken_cache
RUN python -c "import tiktoken; tiktoken.encoding_for_model('gpt2')" \
&& chown -R dify:dify ${TIKTOKEN_CACHE_DIR}
+# Pre-install the spaCy model unstructured needs, so document extraction works offline and as non-root
+RUN python -c "from unstructured.nlp.tokenize import sent_tokenize; sent_tokenize('Warm up.')" \
+ && python -c "import spacy; spacy.load('en_core_web_sm')"
+
# Copy source code
COPY --chown=dify:dify api /app/api/