diff --git a/Dockerfile b/Dockerfile index a78beeab3..00e3d4f55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -77,11 +77,26 @@ ENV PATH=/root/.local/bin:$PATH # nodejs 12.22 on Ubuntu 22.04 is too old RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ - apt purge -y nodejs npm && \ - apt autoremove && \ + apt purge -y nodejs npm cargo && \ + apt autoremove -y && \ apt update && \ - apt install -y nodejs cargo + apt install -y nodejs +# A modern version of cargo is needed for the latest version of the Rust compiler. +RUN apt update && apt install -y curl build-essential \ + && if [ "$NEED_MIRROR" == "1" ]; then \ + # Use TUNA mirrors for rustup/rust dist files + export RUSTUP_DIST_SERVER="https://mirrors.tuna.tsinghua.edu.cn/rustup"; \ + export RUSTUP_UPDATE_ROOT="https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup"; \ + echo "Using TUNA mirrors for Rustup."; \ + fi; \ + # Force curl to use HTTP/1.1 + curl --proto '=https' --tlsv1.2 --http1.1 -sSf https://sh.rustup.rs | bash -s -- -y --profile minimal \ + && echo 'export PATH="/root/.cargo/bin:${PATH}"' >> /root/.bashrc + +ENV PATH="/root/.cargo/bin:${PATH}" + +RUN cargo --version && rustc --version # Add msssql ODBC driver # macOS ARM64 environment, install msodbcsql18. @@ -90,11 +105,12 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ apt update && \ - if [ -n "$ARCH" ] && [ "$ARCH" = "arm64" ]; then \ - # MacOS ARM64 + arch="$(uname -m)"; \ + if [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then \ + # ARM64 (macOS/Apple Silicon or Linux aarch64) ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql18; \ else \ - # (x86_64) + # x86_64 or others ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql17; \ fi || \ { echo "Failed to install ODBC driver"; exit 1; } diff --git a/docker/docker-compose-macos.yml b/docker/docker-compose-macos.yml new file mode 100644 index 000000000..4862c0e2b --- /dev/null +++ b/docker/docker-compose-macos.yml @@ -0,0 +1,56 @@ +include: + - ./docker-compose-base.yml + +services: + ragflow: + depends_on: + mysql: + condition: service_healthy + build: + context: ../ + dockerfile: Dockerfile + container_name: ragflow-server + ports: + - ${SVR_HTTP_PORT}:9380 + - 80:80 + - 443:443 + volumes: + - ./ragflow-logs:/ragflow/logs + - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf + - ./nginx/proxy.conf:/etc/nginx/proxy.conf + - ./nginx/nginx.conf:/etc/nginx/nginx.conf + env_file: .env + environment: + - TZ=${TIMEZONE} + - HF_ENDPOINT=${HF_ENDPOINT} + - MACOS=${MACOS:-1} + - LIGHTEN=${LIGHTEN:-1} + networks: + - ragflow + restart: on-failure + # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration + # If you're using Docker Desktop, the --add-host flag is optional. This flag makes sure that the host's internal IP gets exposed to the Prometheus container. + extra_hosts: + - "host.docker.internal:host-gateway" + # executor: + # depends_on: + # mysql: + # condition: service_healthy + # image: ${RAGFLOW_IMAGE} + # container_name: ragflow-executor + # volumes: + # - ./ragflow-logs:/ragflow/logs + # - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf + # env_file: .env + # environment: + # - TZ=${TIMEZONE} + # - HF_ENDPOINT=${HF_ENDPOINT} + # - MACOS=${MACOS} + # entrypoint: "/ragflow/entrypoint_task_executor.sh 1 3" + # networks: + # - ragflow + # restart: on-failure + # # https://docs.docker.com/engine/daemon/prometheus/#create-a-prometheus-configuration + # # If you're using Docker Desktop, the --add-host flag is optional. This flag makes sure that the host's internal IP gets exposed to the Prometheus container. + # extra_hosts: + # - "host.docker.internal:host-gateway" diff --git a/docs/guides/develop/build_docker_image.mdx b/docs/guides/develop/build_docker_image.mdx index 91f06fcf3..7f2559ab3 100644 --- a/docs/guides/develop/build_docker_image.mdx +++ b/docs/guides/develop/build_docker_image.mdx @@ -41,7 +41,7 @@ While we also test RAGFlow on ARM64 platforms, we do not plan to maintain RAGFlo ```bash git clone https://github.com/infiniflow/ragflow.git cd ragflow/ -docker build --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim . +docker compose -f docker/docker-compose-macos.yml up -d ```