Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Updated Dockerfile (#2695)

Zhichang Yu1518824b0c99
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 3c108e7f92..a556df6f54 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -60,6 +60,7 @@ jobs:
sudo docker compose -f docker/docker-compose.yml up -d
- name: Stop ragflow:dev-slim
+ if: always() # always run this step even if previous steps failed
run: |
sudo docker compose -f docker/docker-compose.yml down -v
@@ -69,5 +70,6 @@ jobs:
sudo docker compose -f docker/docker-compose.yml up -d
- name: Stop ragflow:dev
+ if: always() # always run this step even if previous steps failed
run: |
sudo docker compose -f docker/docker-compose.yml down -v
diff --git a/Dockerfile b/Dockerfile
index 59706754cf..c52ffa5831 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,19 +6,13 @@ ENV LIGHTEN=0
WORKDIR /ragflow
-RUN rm -f /etc/apt/apt.conf.d/docker-clean \
- && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
-
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt-get --no-install-recommends install -y ca-certificates
+RUN apt update && apt --no-install-recommends install -y ca-certificates
# if you located in China, you can use tsinghua mirror to speed up apt
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus \
- && rm -rf /var/lib/apt/lists/* \
- && curl -sSL https://install.python-poetry.org | python3 -
+RUN apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
+ && apt clean && rm -rf /var/lib/apt/lists/*
RUN curl -o libssl1.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb && dpkg -i libssl1.deb && rm -f libssl1.deb
@@ -28,6 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_VIRTUALENVS_CREATE=true
+ENV POETRY_KEYRING_ENABLED=false
ENV POETRY_REQUESTS_TIMEOUT=15
# builder stage
@@ -36,9 +31,8 @@ USER root
WORKDIR /ragflow
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y nodejs npm cargo && \
- rm -rf /var/lib/apt/lists/*
+RUN apt update && apt install -y nodejs npm cargo \
+ && apt clean && rm -rf /var/lib/apt/lists/*
COPY web web
RUN cd web && npm i --force && npm run build
@@ -48,9 +42,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
if [ "$LIGHTEN" -eq 0 ]; then \
- /root/.local/bin/poetry install --sync --no-cache --no-root --with=full; \
+ poetry install --sync --no-cache --no-root --with=full; \
else \
- /root/.local/bin/poetry install --sync --no-cache --no-root; \
+ poetry install --sync --no-cache --no-root; \
fi
# production stage
@@ -61,9 +55,8 @@ WORKDIR /ragflow
# Install python packages' dependencies
# cv2 requires libGL.so.1
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
- rm -rf /var/lib/apt/lists/*
+RUN apt update && apt install -y --no-install-recommends nginx libgl1 vim less \
+ && apt clean && rm -rf /var/lib/apt/lists/*
COPY web web
COPY api api
diff --git a/Dockerfile.slim b/Dockerfile.slim
index b657d9be66..6508f7dc8f 100644
--- a/Dockerfile.slim
+++ b/Dockerfile.slim
@@ -6,19 +6,13 @@ ENV LIGHTEN=1
WORKDIR /ragflow
-RUN rm -f /etc/apt/apt.conf.d/docker-clean \
- && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
-
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt-get --no-install-recommends install -y ca-certificates
+RUN apt update && apt --no-install-recommends install -y ca-certificates
# if you located in China, you can use tsinghua mirror to speed up apt
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus \
- && rm -rf /var/lib/apt/lists/* \
- && curl -sSL https://install.python-poetry.org | python3 -
+RUN apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
+ && apt clean && rm -rf /var/lib/apt/lists/*
RUN curl -o libssl1.deb http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb && dpkg -i libssl1.deb && rm -f libssl1.deb
@@ -28,6 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_VIRTUALENVS_CREATE=true
+ENV POETRY_KEYRING_ENABLED=false
ENV POETRY_REQUESTS_TIMEOUT=15
# builder stage
@@ -36,9 +31,8 @@ USER root
WORKDIR /ragflow
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y nodejs npm cargo && \
- rm -rf /var/lib/apt/lists/*
+RUN apt update && apt install -y nodejs npm cargo \
+ && apt clean && rm -rf /var/lib/apt/lists/*
COPY web web
RUN cd web && npm i --force && npm run build
@@ -48,9 +42,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
if [ "$LIGHTEN" -eq 0 ]; then \
- /root/.local/bin/poetry install --sync --no-cache --no-root --with=full; \
+ poetry install --sync --no-cache --no-root --with=full; \
else \
- /root/.local/bin/poetry install --sync --no-cache --no-root; \
+ poetry install --sync --no-cache --no-root; \
fi
# production stage
@@ -61,9 +55,8 @@ WORKDIR /ragflow
# Install python packages' dependencies
# cv2 requires libGL.so.1
-RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
- apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
- rm -rf /var/lib/apt/lists/*
+RUN apt update && apt install -y --no-install-recommends nginx libgl1 vim less \
+ && apt clean && rm -rf /var/lib/apt/lists/*
COPY web web
COPY api api