mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 18:55:53 +08:00
Refactor dockerfile (#3741)
### What problem does this PR solve? ### Type of change - [x] Refactoring
This commit is contained in:
parent
27cd765d6f
commit
9a3febb7c5
66
Dockerfile
66
Dockerfile
@ -59,6 +59,21 @@ USER root
|
|||||||
|
|
||||||
WORKDIR /ragflow
|
WORKDIR /ragflow
|
||||||
|
|
||||||
|
# install dependencies from poetry.lock file
|
||||||
|
COPY pyproject.toml poetry.toml poetry.lock ./
|
||||||
|
|
||||||
|
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
||||||
|
if [ "$LIGHTEN" == "1" ]; then \
|
||||||
|
poetry install --no-root; \
|
||||||
|
else \
|
||||||
|
poetry install --no-root --with=full; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
COPY web web
|
||||||
|
COPY docs docs
|
||||||
|
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
||||||
|
cd web && npm install --force && npm run build
|
||||||
|
|
||||||
COPY .git /ragflow/.git
|
COPY .git /ragflow/.git
|
||||||
|
|
||||||
RUN current_commit=$(git rev-parse --short HEAD); \
|
RUN current_commit=$(git rev-parse --short HEAD); \
|
||||||
@ -78,28 +93,16 @@ RUN current_commit=$(git rev-parse --short HEAD); \
|
|||||||
echo "RAGFlow version: $version_info"; \
|
echo "RAGFlow version: $version_info"; \
|
||||||
echo $version_info > /ragflow/VERSION
|
echo $version_info > /ragflow/VERSION
|
||||||
|
|
||||||
COPY web web
|
|
||||||
COPY docs docs
|
|
||||||
RUN --mount=type=cache,id=ragflow_builder_npm,target=/root/.npm,sharing=locked \
|
|
||||||
cd web && npm install --force && npm run build
|
|
||||||
|
|
||||||
# install dependencies from poetry.lock file
|
|
||||||
COPY pyproject.toml poetry.toml poetry.lock ./
|
|
||||||
|
|
||||||
RUN --mount=type=cache,id=ragflow_builder_poetry,target=/root/.cache/pypoetry,sharing=locked \
|
|
||||||
if [ "$LIGHTEN" == "1" ]; then \
|
|
||||||
poetry install --no-root; \
|
|
||||||
else \
|
|
||||||
poetry install --no-root --with=full; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# production stage
|
# production stage
|
||||||
FROM base AS production
|
FROM base AS production
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
WORKDIR /ragflow
|
WORKDIR /ragflow
|
||||||
|
|
||||||
COPY --from=builder /ragflow/VERSION /ragflow/VERSION
|
# Copy Python environment and packages
|
||||||
|
ENV VIRTUAL_ENV=/ragflow/.venv
|
||||||
|
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||||
|
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
||||||
|
|
||||||
# Install python packages' dependencies
|
# Install python packages' dependencies
|
||||||
# cv2 requires libGL.so.1
|
# cv2 requires libGL.so.1
|
||||||
@ -107,15 +110,6 @@ RUN --mount=type=cache,id=ragflow_production_apt,target=/var/cache/apt,sharing=l
|
|||||||
apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
|
apt update && apt install -y --no-install-recommends nginx libgl1 vim less && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY web web
|
|
||||||
COPY api api
|
|
||||||
COPY conf conf
|
|
||||||
COPY deepdoc deepdoc
|
|
||||||
COPY rag rag
|
|
||||||
COPY agent agent
|
|
||||||
COPY graphrag graphrag
|
|
||||||
COPY pyproject.toml poetry.toml poetry.lock ./
|
|
||||||
|
|
||||||
# Copy models downloaded via download_deps.py
|
# Copy models downloaded via download_deps.py
|
||||||
RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow
|
RUN mkdir -p /ragflow/rag/res/deepdoc /root/.ragflow
|
||||||
RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co \
|
RUN --mount=type=bind,source=huggingface.co,target=/huggingface.co \
|
||||||
@ -153,18 +147,24 @@ RUN --mount=type=bind,source=chromedriver-linux64-121-0-6167-85,target=/chromedr
|
|||||||
mv chromedriver /usr/local/bin/ && \
|
mv chromedriver /usr/local/bin/ && \
|
||||||
rm -f /usr/bin/google-chrome
|
rm -f /usr/bin/google-chrome
|
||||||
|
|
||||||
# Copy compiled web pages
|
|
||||||
COPY --from=builder /ragflow/web/dist /ragflow/web/dist
|
|
||||||
|
|
||||||
# Copy Python environment and packages
|
|
||||||
ENV VIRTUAL_ENV=/ragflow/.venv
|
|
||||||
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
|
||||||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
|
|
||||||
|
|
||||||
ENV PYTHONPATH=/ragflow/
|
ENV PYTHONPATH=/ragflow/
|
||||||
|
|
||||||
|
COPY web web
|
||||||
|
COPY api api
|
||||||
|
COPY conf conf
|
||||||
|
COPY deepdoc deepdoc
|
||||||
|
COPY rag rag
|
||||||
|
COPY agent agent
|
||||||
|
COPY graphrag graphrag
|
||||||
|
COPY pyproject.toml poetry.toml poetry.lock ./
|
||||||
|
|
||||||
COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
|
COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
|
||||||
COPY docker/entrypoint.sh ./entrypoint.sh
|
COPY docker/entrypoint.sh ./entrypoint.sh
|
||||||
RUN chmod +x ./entrypoint.sh
|
RUN chmod +x ./entrypoint.sh
|
||||||
|
|
||||||
|
# Copy compiled web pages
|
||||||
|
COPY --from=builder /ragflow/web/dist /ragflow/web/dist
|
||||||
|
|
||||||
|
COPY --from=builder /ragflow/VERSION /ragflow/VERSION
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user