Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(docker): Add non-root user to production ldr stage

LearningCircuitebd116ee8c8b
diff --git a/Dockerfile b/Dockerfile
index b8e4e5b99d..5ca5326625 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -181,6 +181,14 @@ RUN apt-get update && apt-get upgrade -y \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
+# Create non-root user for running service (security best practice)
+RUN groupadd -r ldruser && useradd -r -g ldruser -u 1000 -m -d /home/ldruser ldruser
+
+# Create directories with proper permissions for non-root user
+RUN mkdir -p /app/.config/local_deep_research /home/ldruser/.local/share && \
+ chown -R ldruser:ldruser /app /home/ldruser && \
+ chmod -R 755 /app /home/ldruser
+
# retrieve packages from build stage
COPY --from=builder /install/.venv/ /install/.venv
ENV PATH="/install/.venv/bin:$PATH"
@@ -194,7 +202,7 @@ RUN python -c "from local_deep_research.database.sqlcipher_compat import get_sql
RUN playwright install
# Create volume for persistent configuration
-# Use /app for configuration to support non-root users in test container
+# Use /app for configuration to support non-root user
VOLUME /app/.config/local_deep_research
# Create volume for Ollama start script
@@ -203,8 +211,14 @@ VOLUME /scripts/
ADD scripts/ollama_entrypoint.sh /scripts/ollama_entrypoint.sh
RUN chmod +x /scripts/ollama_entrypoint.sh
+# Ensure all directories are owned by ldruser before switching
+RUN chown -R ldruser:ldruser /install /scripts /home/ldruser
+
EXPOSE 5000
STOPSIGNAL SIGINT
+# Switch to non-root user for running service (security best practice)
+USER ldruser
+
# Use PDM to run the application
CMD [ "ldr-web" ]