build_docker_image.mdx


Overview

The build_docker_image.mdx file serves as a comprehensive user guide and tutorial on how to build and deploy Docker images for the RAGFlow project. It is designed primarily for developers and testers who need to create local Docker images for debugging, development, or testing purposes. The documentation covers two main Docker build options: one without embedding models (smaller image) and another including embedding models (larger image). It also provides instructions on launching the RAGFlow service on macOS platforms, specifically targeting Apple M1/M2 ARM64 architectures.

This file is a Markdown/MDX document used in the RAGFlow documentation website and includes interactive tabs to separate build instructions, making it easy for users to follow based on their needs.


Detailed Content Description

Purpose and Functionality


Sections & Usage

1. Target Audience

Defines who benefits from this document:

2. Prerequisites

Lists minimum system requirements to build and run RAGFlow Docker images:

Resource

Minimum Requirement

CPU

4 cores or more

RAM

16 GB or more

Disk Space

50 GB or more

Docker

Version 24.0.0 or higher

Docker Compose

Version 2.26.1 or higher

3. Build a Docker image

This section uses and <TabItem> components to separate instructions into two options:

a) Build a Docker image without embedding models (Lightweight, ~2GB)

b) Build a Docker image including embedding models (~9GB)

4. Launch a RAGFlow Service from Docker for MacOS

Provides instructions to deploy the built Docker image alongside dependent services such as Elasticsearch, MySQL, MinIO, and Redis using Docker Compose.

Example for Apple M2 Pro:

  1. Edit Docker Compose Configuration

    Modify the docker/.env file to point the RAGFLOW_IMAGE variable to the newly built image tag (e.g., infiniflow/ragflow:nightly-slim).

  2. Launch the Service

    cd docker
    docker compose -f docker-compose-macos.yml up -d
    
  3. Access the Service

    Access via browser at http://127.0.0.1 or the respective server IP on port 80.


Important Implementation Details


Interaction with Other System Components


Usage Examples

Build lightweight Docker image

git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv run download_deps.py
docker build -f Dockerfile.deps -t infiniflow/ragflow_deps .
docker build --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .

Build full Docker image with embedding models

git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
uv run download_deps.py
docker build -f Dockerfile.deps -t infiniflow/ragflow_deps .
docker build -f Dockerfile -t infiniflow/ragflow:nightly .

Launch RAGFlow service on macOS (Apple M2 Pro)

# Edit docker/.env to update RAGFLOW_IMAGE
cd docker
docker compose -f docker-compose-macos.yml up -d

Open http://127.0.0.1 to access the RAGFlow UI.


Visual Diagram

Below is a flowchart illustrating the main workflow and relationships between the key functions/steps described in this documentation file.

flowchart TD
    A[Clone RAGFlow Repository] --> B[Download Dependencies\n(uv run download_deps.py)]
    B --> C[Build Dependencies Image\n(Dockerfile.deps)]
    C --> D{Build Options}
    D -->|Lightweight Image| E[Build Docker Image\nwith LIGHTEN=1 (nightly-slim)]
    D -->|Full Image with Embeddings| F[Build Docker Image\nwithout LIGHTEN arg (nightly)]
    E --> G[Edit docker/.env\nSet RAGFLOW_IMAGE to nightly-slim]
    F --> G
    G --> H[Launch Docker Compose\n(docker-compose-macos.yml)]
    H --> I[Access RAGFlow UI\nhttp://127.0.0.1]

Summary

The build_docker_image.mdx file is a critical piece of documentation for anyone looking to build and deploy RAGFlow Docker images. It carefully balances instructions for different build configurations and hardware architectures, emphasizing Docker best practices and system requirements. The interactive tab layout and clear stepwise instructions make it easy for developers and testers to get started with RAGFlow in containerized environments quickly.

This file forms the bridge between RAGFlow’s source code and running, testable Docker containers, integrating closely with Docker Compose and system services like Elasticsearch and Redis to provide a full-stack local development or testing setup.