From bfd847eaca8bc3681e4880416745ce4e7b2b8cb3 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Fri, 28 Oct 2022 21:15:44 +0800 Subject: [PATCH] Prevent leaving pip install cache in Docker image (#985) --- images/bench/Dockerfile | 6 +++--- images/worker/Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/images/bench/Dockerfile b/images/bench/Dockerfile index 1ad22151..2c69e091 100644 --- a/images/bench/Dockerfile +++ b/images/bench/Dockerfile @@ -98,8 +98,8 @@ ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \ && pyenv install $PYTHON_VERSION_V13 \ && pyenv install $PYTHON_VERSION \ - && PYENV_VERSION=$PYTHON_VERSION_V13 pip install virtualenv \ - && PYENV_VERSION=$PYTHON_VERSION pip install virtualenv \ + && PYENV_VERSION=$PYTHON_VERSION_V13 pip install --no-cache-dir virtualenv \ + && PYENV_VERSION=$PYTHON_VERSION pip install --no-cache-dir virtualenv \ && pyenv global $PYTHON_VERSION $PYTHON_VERSION_v13 \ && sed -Ei -e '/^([^#]|$)/ {a export PYENV_ROOT="/home/frappe/.pyenv" a export PATH="$PYENV_ROOT/bin:$PATH" a ' -e ':a' -e '$!{n;ba};}' ~/.profile \ && echo 'eval "$(pyenv init --path)"' >>~/.profile \ @@ -111,7 +111,7 @@ ENV PATH /home/frappe/.local/bin:$PATH # Skip editable-bench warning # https://github.com/frappe/bench/commit/20560c97c4246b2480d7358c722bc9ad13606138 RUN git clone ${GIT_REPO} --depth 1 -b ${GIT_BRANCH} .bench \ - && pip install --user -e .bench \ + && pip install --no-cache-dir --user -e .bench \ && echo "export PATH=/home/frappe/.local/bin:\$PATH" >>/home/frappe/.bashrc \ && echo "export BENCH_DEVELOPER=1" >>/home/frappe/.bashrc diff --git a/images/worker/Dockerfile b/images/worker/Dockerfile index d07965fc..20681c76 100644 --- a/images/worker/Dockerfile +++ b/images/worker/Dockerfile @@ -15,9 +15,9 @@ RUN mkdir -p /home/frappe/frappe-bench/apps /home/frappe/frappe-bench/logs /home WORKDIR /home/frappe/frappe-bench USER root -RUN pip install -U pip wheel \ +RUN pip install --no-cache-dir -U pip wheel \ && python -m venv env \ - && env/bin/pip install -U pip wheel + && env/bin/pip install --no-cache-dir -U pip wheel COPY install-app.sh /usr/local/bin/install-app