Updated Dockerfile (#2695)
Browse files### What problem does this PR solve?
Updated Dockerfile
### Type of change
- [ ] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [x] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
- .github/workflows/tests.yml +2 -0
- Dockerfile +10 -17
- Dockerfile.slim +10 -17
.github/workflows/tests.yml
CHANGED
|
@@ -60,6 +60,7 @@ jobs:
|
|
| 60 |
sudo docker compose -f docker/docker-compose.yml up -d
|
| 61 |
|
| 62 |
- name: Stop ragflow:dev-slim
|
|
|
|
| 63 |
run: |
|
| 64 |
sudo docker compose -f docker/docker-compose.yml down -v
|
| 65 |
|
|
@@ -69,5 +70,6 @@ jobs:
|
|
| 69 |
sudo docker compose -f docker/docker-compose.yml up -d
|
| 70 |
|
| 71 |
- name: Stop ragflow:dev
|
|
|
|
| 72 |
run: |
|
| 73 |
sudo docker compose -f docker/docker-compose.yml down -v
|
|
|
|
| 60 |
sudo docker compose -f docker/docker-compose.yml up -d
|
| 61 |
|
| 62 |
- name: Stop ragflow:dev-slim
|
| 63 |
+
if: always() # always run this step even if previous steps failed
|
| 64 |
run: |
|
| 65 |
sudo docker compose -f docker/docker-compose.yml down -v
|
| 66 |
|
|
|
|
| 70 |
sudo docker compose -f docker/docker-compose.yml up -d
|
| 71 |
|
| 72 |
- name: Stop ragflow:dev
|
| 73 |
+
if: always() # always run this step even if previous steps failed
|
| 74 |
run: |
|
| 75 |
sudo docker compose -f docker/docker-compose.yml down -v
|
Dockerfile
CHANGED
|
@@ -6,19 +6,13 @@ ENV LIGHTEN=0
|
|
| 6 |
|
| 7 |
WORKDIR /ragflow
|
| 8 |
|
| 9 |
-
RUN
|
| 10 |
-
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
| 11 |
-
|
| 12 |
-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
| 13 |
-
apt update && apt-get --no-install-recommends install -y ca-certificates
|
| 14 |
|
| 15 |
# if you located in China, you can use tsinghua mirror to speed up apt
|
| 16 |
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
|
| 17 |
|
| 18 |
-
RUN
|
| 19 |
-
|
| 20 |
-
&& rm -rf /var/lib/apt/lists/* \
|
| 21 |
-
&& curl -sSL https://install.python-poetry.org | python3 -
|
| 22 |
|
| 23 |
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
|
| 24 |
|
|
@@ -28,6 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
|
| 28 |
ENV POETRY_NO_INTERACTION=1
|
| 29 |
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
| 30 |
ENV POETRY_VIRTUALENVS_CREATE=true
|
|
|
|
| 31 |
ENV POETRY_REQUESTS_TIMEOUT=15
|
| 32 |
|
| 33 |
# builder stage
|
|
@@ -36,9 +31,8 @@ USER root
|
|
| 36 |
|
| 37 |
WORKDIR /ragflow
|
| 38 |
|
| 39 |
-
RUN
|
| 40 |
-
apt
|
| 41 |
-
rm -rf /var/lib/apt/lists/*
|
| 42 |
|
| 43 |
COPY web web
|
| 44 |
RUN cd web && npm i --force && npm run build
|
|
@@ -48,9 +42,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./
|
|
| 48 |
|
| 49 |
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
|
| 50 |
if [ "$LIGHTEN" -eq 0 ]; then \
|
| 51 |
-
|
| 52 |
else \
|
| 53 |
-
|
| 54 |
fi
|
| 55 |
|
| 56 |
# production stage
|
|
@@ -61,9 +55,8 @@ WORKDIR /ragflow
|
|
| 61 |
|
| 62 |
# Install python packages' dependencies
|
| 63 |
# cv2 requires libGL.so.1
|
| 64 |
-
RUN
|
| 65 |
-
apt
|
| 66 |
-
rm -rf /var/lib/apt/lists/*
|
| 67 |
|
| 68 |
COPY web web
|
| 69 |
COPY api api
|
|
|
|
| 6 |
|
| 7 |
WORKDIR /ragflow
|
| 8 |
|
| 9 |
+
RUN apt update && apt --no-install-recommends install -y ca-certificates
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# if you located in China, you can use tsinghua mirror to speed up apt
|
| 12 |
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
|
| 13 |
|
| 14 |
+
RUN apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
|
| 15 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 16 |
|
| 17 |
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
|
| 18 |
|
|
|
|
| 22 |
ENV POETRY_NO_INTERACTION=1
|
| 23 |
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
| 24 |
ENV POETRY_VIRTUALENVS_CREATE=true
|
| 25 |
+
ENV POETRY_KEYRING_ENABLED=false
|
| 26 |
ENV POETRY_REQUESTS_TIMEOUT=15
|
| 27 |
|
| 28 |
# builder stage
|
|
|
|
| 31 |
|
| 32 |
WORKDIR /ragflow
|
| 33 |
|
| 34 |
+
RUN apt update && apt install -y nodejs npm cargo \
|
| 35 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 36 |
|
| 37 |
COPY web web
|
| 38 |
RUN cd web && npm i --force && npm run build
|
|
|
|
| 42 |
|
| 43 |
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
|
| 44 |
if [ "$LIGHTEN" -eq 0 ]; then \
|
| 45 |
+
poetry install --sync --no-cache --no-root --with=full; \
|
| 46 |
else \
|
| 47 |
+
poetry install --sync --no-cache --no-root; \
|
| 48 |
fi
|
| 49 |
|
| 50 |
# production stage
|
|
|
|
| 55 |
|
| 56 |
# Install python packages' dependencies
|
| 57 |
# cv2 requires libGL.so.1
|
| 58 |
+
RUN apt update && apt install -y --no-install-recommends nginx libgl1 vim less \
|
| 59 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 60 |
|
| 61 |
COPY web web
|
| 62 |
COPY api api
|
Dockerfile.slim
CHANGED
|
@@ -6,19 +6,13 @@ ENV LIGHTEN=1
|
|
| 6 |
|
| 7 |
WORKDIR /ragflow
|
| 8 |
|
| 9 |
-
RUN
|
| 10 |
-
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
|
| 11 |
-
|
| 12 |
-
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
| 13 |
-
apt update && apt-get --no-install-recommends install -y ca-certificates
|
| 14 |
|
| 15 |
# if you located in China, you can use tsinghua mirror to speed up apt
|
| 16 |
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
|
| 17 |
|
| 18 |
-
RUN
|
| 19 |
-
|
| 20 |
-
&& rm -rf /var/lib/apt/lists/* \
|
| 21 |
-
&& curl -sSL https://install.python-poetry.org | python3 -
|
| 22 |
|
| 23 |
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
|
| 24 |
|
|
@@ -28,6 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
|
|
| 28 |
ENV POETRY_NO_INTERACTION=1
|
| 29 |
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
| 30 |
ENV POETRY_VIRTUALENVS_CREATE=true
|
|
|
|
| 31 |
ENV POETRY_REQUESTS_TIMEOUT=15
|
| 32 |
|
| 33 |
# builder stage
|
|
@@ -36,9 +31,8 @@ USER root
|
|
| 36 |
|
| 37 |
WORKDIR /ragflow
|
| 38 |
|
| 39 |
-
RUN
|
| 40 |
-
apt
|
| 41 |
-
rm -rf /var/lib/apt/lists/*
|
| 42 |
|
| 43 |
COPY web web
|
| 44 |
RUN cd web && npm i --force && npm run build
|
|
@@ -48,9 +42,9 @@ COPY pyproject.toml poetry.toml poetry.lock ./
|
|
| 48 |
|
| 49 |
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
|
| 50 |
if [ "$LIGHTEN" -eq 0 ]; then \
|
| 51 |
-
|
| 52 |
else \
|
| 53 |
-
|
| 54 |
fi
|
| 55 |
|
| 56 |
# production stage
|
|
@@ -61,9 +55,8 @@ WORKDIR /ragflow
|
|
| 61 |
|
| 62 |
# Install python packages' dependencies
|
| 63 |
# cv2 requires libGL.so.1
|
| 64 |
-
RUN
|
| 65 |
-
apt
|
| 66 |
-
rm -rf /var/lib/apt/lists/*
|
| 67 |
|
| 68 |
COPY web web
|
| 69 |
COPY api api
|
|
|
|
| 6 |
|
| 7 |
WORKDIR /ragflow
|
| 8 |
|
| 9 |
+
RUN apt update && apt --no-install-recommends install -y ca-certificates
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# if you located in China, you can use tsinghua mirror to speed up apt
|
| 12 |
RUN sed -i 's|http://archive.ubuntu.com|https://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
|
| 13 |
|
| 14 |
+
RUN apt update && apt install -y curl libpython3-dev nginx libglib2.0-0 libglx-mesa0 pkg-config libicu-dev libgdiplus python3-poetry \
|
| 15 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 16 |
|
| 17 |
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
|
| 18 |
|
|
|
|
| 22 |
ENV POETRY_NO_INTERACTION=1
|
| 23 |
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
| 24 |
ENV POETRY_VIRTUALENVS_CREATE=true
|
| 25 |
+
ENV POETRY_KEYRING_ENABLED=false
|
| 26 |
ENV POETRY_REQUESTS_TIMEOUT=15
|
| 27 |
|
| 28 |
# builder stage
|
|
|
|
| 31 |
|
| 32 |
WORKDIR /ragflow
|
| 33 |
|
| 34 |
+
RUN apt update && apt install -y nodejs npm cargo \
|
| 35 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 36 |
|
| 37 |
COPY web web
|
| 38 |
RUN cd web && npm i --force && npm run build
|
|
|
|
| 42 |
|
| 43 |
RUN --mount=type=cache,target=/root/.cache/pypoetry,sharing=locked \
|
| 44 |
if [ "$LIGHTEN" -eq 0 ]; then \
|
| 45 |
+
poetry install --sync --no-cache --no-root --with=full; \
|
| 46 |
else \
|
| 47 |
+
poetry install --sync --no-cache --no-root; \
|
| 48 |
fi
|
| 49 |
|
| 50 |
# production stage
|
|
|
|
| 55 |
|
| 56 |
# Install python packages' dependencies
|
| 57 |
# cv2 requires libGL.so.1
|
| 58 |
+
RUN apt update && apt install -y --no-install-recommends nginx libgl1 vim less \
|
| 59 |
+
&& apt clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
| 60 |
|
| 61 |
COPY web web
|
| 62 |
COPY api api
|