1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-18 08:27:03 +02:00

Speed up Docker image build and make image smaller

Run `apt-get upgrade` right after `apt-get install`, instead of cleaning
up apt index first, do `apt-get update` again, then `apt-get upgrade`.

This will save some build time and disk space, because it didn't clean
up apt index after the `apt-get upgrade` before.
This commit is contained in:
Peter Dave Hello 2023-05-19 22:01:23 +08:00
parent 9f1417f28c
commit 6c5f27d7f1
2 changed files with 2 additions and 4 deletions

View File

@ -5,11 +5,10 @@ WORKDIR /app
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \ RUN apt-get update -qq \
&& apt-get -qqq install --no-install-recommends -y pkg-config gcc g++ \ && apt-get -qqq install --no-install-recommends -y pkg-config gcc g++ \
&& apt-get upgrade --assume-yes \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt && rm -rf /var/lib/apt
RUN apt-get update && apt-get upgrade --assume-yes
RUN python -mvenv venv && ./venv/bin/pip install --upgrade pip RUN python -mvenv venv && ./venv/bin/pip install --upgrade pip
COPY . . COPY . .

View File

@ -9,11 +9,10 @@ WORKDIR /app
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \ RUN apt-get update -qq \
&& apt-get -qqq install --no-install-recommends -y libicu-dev libaspell-dev libcairo2 libcairo2-dev pkg-config gcc g++ python3.8-dev python3-pip libpython3.8-dev\ && apt-get -qqq install --no-install-recommends -y libicu-dev libaspell-dev libcairo2 libcairo2-dev pkg-config gcc g++ python3.8-dev python3-pip libpython3.8-dev\
&& apt-get upgrade --assume-yes \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt && rm -rf /var/lib/apt
RUN apt-get update && apt-get upgrade --assume-yes
RUN pip3 install --upgrade pip && apt-get remove python3-pip --assume-yes RUN pip3 install --upgrade pip && apt-get remove python3-pip --assume-yes
RUN ln -s /usr/bin/python3 /usr/bin/python RUN ln -s /usr/bin/python3 /usr/bin/python