From eb506221c3deadd457b8a9fe41b650fde504f6cf Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Tue, 14 Jul 2026 16:08:15 +0800 Subject: [PATCH] Update dockerfile (#16893) ### Summary To reuse docker building cache --------- Signed-off-by: Jin Hai --- Dockerfile | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27cd035f82..6e5d87f945 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,6 @@ ENV DEBIAN_FRONTEND=noninteractive # selenium: libatk-bridge2.0-0 chrome-linux64-121-0-6167-85 # Building C extensions: libpython3-dev libgtk-4-1 libnss3 xdg-utils libgbm-dev RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ - apt update && \ - apt --no-install-recommends install -y ca-certificates; \ if [ "$NEED_MIRROR" == "1" ]; then \ # CI runners may inject a proxy whose TLS certificate is not trusted inside # the fresh Ubuntu base image yet. Keep the Ubuntu mirror on HTTP here so @@ -45,9 +43,11 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ chmod 1777 /tmp && \ apt update && \ - apt install -y \ - libglib2.0-0 libglx-mesa0 libgl1 pkg-config libgdiplus default-jdk libatk-bridge2.0-0 libgtk-4-1 libnss3 xdg-utils libjemalloc-dev gnupg unzip curl wget git vim less ghostscript pandoc texlive texlive-latex-extra texlive-xetex texlive-lang-chinese fonts-freefont-ttf fonts-noto-cjk postgresql-client && \ - rm -rf /var/lib/apt/lists/* + apt --no-install-recommends install -y ca-certificates \ + libglib2.0-0 libglx-mesa0 libgl1 pkg-config libgdiplus default-jdk libatk-bridge2.0-0 \ + libgtk-4-1 libnss3 xdg-utils libjemalloc-dev gnupg unzip curl wget git vim less \ + ghostscript pandoc texlive texlive-latex-extra texlive-xetex texlive-lang-chinese \ + fonts-freefont-ttf fonts-noto-cjk postgresql-client # Download resource from GitHub to /usr/share/infinity RUN mkdir -p /usr/share/infinity/resource && \ @@ -66,8 +66,7 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ echo "deb [signed-by=/etc/apt/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/mainline/ubuntu/ noble nginx" > /etc/apt/sources.list.d/nginx.list && \ apt -o Acquire::Retries=5 update && \ apt -o Acquire::Retries=5 install -y nginx=${NGINX_VERSION} && \ - apt-mark hold nginx && \ - rm -rf /var/lib/apt/lists/* + apt-mark hold nginx # Install uv RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/,target=/deps \ @@ -96,8 +95,7 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ apt purge -y nodejs npm && \ apt autoremove -y && \ apt update && \ - apt install -y nodejs && \ - rm -rf /var/lib/apt/lists/* + apt install -y nodejs # stagehand-server-v3 (Node.js SEA binary used by Browser component # in local mode). @@ -156,12 +154,9 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ else \ # x86_64 or others \ ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql17; \ - fi && \ - rm -rf /var/lib/apt/lists/* || \ + fi || \ { echo "Failed to install ODBC driver"; exit 1; } - - # Add dependencies of selenium RUN --mount=type=bind,from=infiniflow/ragflow_deps:latest,source=/chrome-linux64-121-0-6167-85,target=/chrome-linux64.zip \ unzip /chrome-linux64.zip && \ @@ -189,7 +184,6 @@ WORKDIR /ragflow # Install build-only dependencies for compiling Python C extensions. # These are not inherited from base to keep the production image smaller. RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ - apt update && \ apt install -y build-essential libpython3-dev libicu-dev libgbm-dev && \ rm -rf /var/lib/apt/lists/* @@ -235,12 +229,9 @@ COPY docs docs RUN --mount=type=cache,id=ragflow_npm,target=/root/.npm,sharing=locked \ cd web && NODE_OPTIONS="--max-old-space-size=8192" VITE_BUILD_SOURCEMAP=false VITE_MINIFY=esbuild npm run build -COPY .git /ragflow/.git - -RUN version_info=$(git describe --tags --match=v* --first-parent --always); \ - version_info="$version_info"; \ - echo "RAGFlow version: $version_info"; \ - echo $version_info > /ragflow/VERSION +RUN --mount=type=bind,source=.git,target=/ragflow/.git \ + version_info=$(git describe --tags --match=v* --first-parent --always) && \ + echo "$version_info" > /ragflow/VERSION # production stage FROM base AS production