Added docket to minirag

This commit is contained in:
Saifeddine ALOUI
2025-01-30 23:42:28 +01:00
parent e874a875cf
commit 946555016a
2 changed files with 71 additions and 0 deletions

49
Dockerfile Normal file
View File

@@ -0,0 +1,49 @@
# Build stage
FROM python:3.11-slim as builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
pkg-config \
libssl-dev \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& . "$HOME/.cargo/env" \
&& rustup default stable \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/root/.cargo/bin:${PATH}"
# Copy only requirements files first to leverage Docker cache
COPY requirements.txt .
COPY minirag/api/requirements.txt ./minirag/api/
# Install dependencies
RUN pip install --user --no-cache-dir -r requirements.txt
RUN pip install --user --no-cache-dir -r minirag/api/requirements.txt
# Final stage
FROM python:3.11-slim
WORKDIR /app
# Copy only necessary files from builder
COPY --from=builder /root/.local /root/.local
COPY ./minirag ./minirag
COPY setup.py .
COPY .env .
RUN pip install .
# Make sure scripts in .local are usable
ENV PATH=/root/.local/bin:$PATH
# Create necessary directories
RUN mkdir -p /app/data/rag_storage /app/data/inputs
# Expose the default port
EXPOSE 9621
# Set entrypoint
ENTRYPOINT ["python", "-m", "minirag.api.minirag_server"]

22
docker-compose.yml Normal file
View File

@@ -0,0 +1,22 @@
version: '3.8'
services:
lightrag:
build: .
ports:
- "${PORT:-9721}:9721"
volumes:
- ./data/rag_storage:/app/data/rag_storage
- ./data/inputs:/app/data/inputs
env_file:
- .env
environment:
- TZ=UTC
restart: unless-stopped
networks:
- lightrag_net
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
lightrag_net:
driver: bridge