From 4c63602fd9e9f034c96f0bac689a2cc5507d1f58 Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Mon, 9 Feb 2026 21:20:44 +0100 Subject: [PATCH] Fix HuggingFace and NLTK cache PermissionError in Docker The entrypoint uses `su -p app` which preserves HOME=/root from the root user. HuggingFace and NLTK default to ~/cache paths, resolving to /root/ which the app user cannot write to. Set HF_HOME and NLTK_DATA env vars to writable directories owned by the app user. --- backend/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index f7b3127700..40fef75b92 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -73,9 +73,10 @@ ENV LIBRARY_PATH=/lib:/usr/lib LD_LIBRARY_PATH=/lib:/usr/lib RUN apt-get update -y && apt-get install -y curl RUN groupadd -r app && useradd -r -g app app && mkdir -p ${FUNCTION_DIR} && chown -R app:app ${FUNCTION_DIR} \ - && mkdir -p /home/app/.cache/huggingface && chown -R app:app /home/app/.cache + && mkdir -p /home/app/.cache/huggingface /home/app/nltk_data && chown -R app:app /home/app/.cache /home/app/nltk_data ENV HF_HOME=/home/app/.cache/huggingface +ENV NLTK_DATA=/home/app/nltk_data COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/*.html ${FUNCTION_DIR}/custom_admin/templates/astro/ COPY --chown=app:app --from=js-stage ${FUNCTION_DIR}/dist/widgets/*.html ${FUNCTION_DIR}/custom_admin/templates/astro/widgets/