Update Dockerfile and API requirements for improved build and dependencies

- Add Rust installation to Dockerfile for potential performance improvements
- Set explicit Docker data directories
- Add graspologic library to API requirements
- Optimize Docker build stages and environment setup
This commit is contained in:
coredevorg
2025-03-11 10:39:55 +00:00
parent 11a5a04c4d
commit bc5ccc5f19
2 changed files with 16 additions and 1 deletions

View File

@@ -1,13 +1,23 @@
# Build stage # Build stage
FROM python:3.11-slim as builder FROM python:3.11-slim AS builder
WORKDIR /app WORKDIR /app
# Install Rust and required build dependencies
RUN apt-get update && apt-get install -y \
curl \
build-essential \
pkg-config \
&& rm -rf /var/lib/apt/lists/* \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& . $HOME/.cargo/env
# Copy only requirements files first to leverage Docker cache # Copy only requirements files first to leverage Docker cache
COPY requirements.txt . COPY requirements.txt .
COPY lightrag/api/requirements.txt ./lightrag/api/ COPY lightrag/api/requirements.txt ./lightrag/api/
# Install dependencies # Install dependencies
ENV PATH="/root/.cargo/bin:${PATH}"
RUN pip install --user --no-cache-dir -r requirements.txt RUN pip install --user --no-cache-dir -r requirements.txt
RUN pip install --user --no-cache-dir -r lightrag/api/requirements.txt RUN pip install --user --no-cache-dir -r lightrag/api/requirements.txt
@@ -28,6 +38,10 @@ ENV PATH=/root/.local/bin:$PATH
# Create necessary directories # Create necessary directories
RUN mkdir -p /app/data/rag_storage /app/data/inputs RUN mkdir -p /app/data/rag_storage /app/data/inputs
# Docker data directories
ENV WORKING_DIR=/app/data/rag_storage
ENV INPUT_DIR=/app/data/inputs
# Expose the default port # Expose the default port
EXPOSE 9621 EXPOSE 9621

View File

@@ -18,3 +18,4 @@ pytz
tenacity tenacity
tiktoken tiktoken
uvicorn uvicorn
graspologic>=3.4.1