Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
use --no-cache-dir flag to pip in dockerfiles to save space (#1189)
Browse files Browse the repository at this point in the history
using "--no-cache-dir" flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
  • Loading branch information
Rajpratik71 authored Nov 4, 2020
1 parent 50c2dc1 commit babd9c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker/event-sources/kubernetes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM bitnami/minideb:jessie
RUN install_packages python3 curl ca-certificates git
RUN curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
RUN python3 ./get-pip.py
RUN pip3 install --upgrade kubernetes
RUN pip3 install --upgrade requests
RUN pip3 install --no-cache-dir --upgrade kubernetes
RUN pip3 install --no-cache-dir --upgrade requests

RUN git clone --depth 1 https://github.com/dpkp/kafka-python
WORKDIR kafka-python
Expand Down

0 comments on commit babd9c8

Please sign in to comment.