From 82b5d0ca6f636f4d7377abf08feb5bfe3dfa87d0 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 9 Aug 2023 01:14:29 +0800 Subject: [PATCH 1/2] Use `pip install` with `--no-cache-dir` in Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 60e5f249..b9a30ef1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,14 +11,14 @@ RUN apt-get install -y python3 pip locales RUN apt-get install -y nodejs RUN apt-get install -y npm RUN npm install --global sass -RUN python3 -m pip install -U pip setuptools +RUN python3 -m pip install --no-cache-dir -U pip setuptools RUN locale-gen "en_US.UTF-8" WORKDIR /opt/app COPY . . -RUN pip3 install -r requirements.txt +RUN pip3 install --no-cache-dir -r requirements.txt RUN invoke build EXPOSE 8080 From e8ed5f2f4eee7a7b5b0e01042f9b04e686272d7a Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 9 Aug 2023 02:33:50 +0800 Subject: [PATCH 2/2] Optimize apt-get process in Dockerfile --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b9a30ef1..dcf2a64e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,11 @@ ARG DEBIAN_FRONTEND=noninteractive LABEL org.opencontainers.image.authors="Sebastian Sasu , Cristian Magherusan-Stanciu , Brooke McKim " -RUN apt-get update -RUN apt-get install -y python3 pip locales -RUN apt-get install -y nodejs -RUN apt-get install -y npm +RUN apt-get update && \ + apt-get install -y python3 pip locales \ + nodejs \ + npm && \ + rm -rf /var/lib/apt/lists/* RUN npm install --global sass RUN python3 -m pip install --no-cache-dir -U pip setuptools RUN locale-gen "en_US.UTF-8"