Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
use --no-cache-dir flag to pip in dockerfiles to save space
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 <[email protected]>
  • Loading branch information
Rajpratik71 committed Apr 8, 2021
1 parent 2d6fd35 commit 4d819a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions applications/openvino/benchmark/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN wget $OPENVINO_LINK && \
rm -rf /tmp/l_openvino_toolkit* && \
ln --symbolic /opt/intel/openvino_"$YEAR"/ /opt/intel/openvino

RUN pip3 install networkx==2.3
RUN pip3 install --no-cache-dir networkx==2.3
WORKDIR /opt/intel/openvino_$YEAR/deployment_tools/demo
RUN /bin/bash -c "source $INSTALL_DIR/bin/setupvars.sh && ./demo_squeezenet_download_convert_run.sh"
WORKDIR /root/inference_engine_samples_build
Expand All @@ -70,7 +70,7 @@ USER openvino
#Download OpenVINO pre-trained models

WORKDIR /opt/intel/openvino_$YEAR/deployment_tools/open_model_zoo/tools/downloader
RUN pip3 install pyyaml requests
RUN pip3 install --no-cache-dir pyyaml requests
RUN ./downloader.py --name face-detection-retail-0004
RUN ./downloader.py --name squeezenet1.1
RUN ./downloader.py --name semantic-segmentation-adas-0001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN python3.6 get-pip.py

# needed by openedge when build
RUN apk add --no-cache zip unzip tcpdump
RUN pip3 install protobuf
RUN pip3 install --no-cache-dir protobuf

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
Expand All @@ -45,7 +45,7 @@ RUN apk add --no-cache musl-dev
#WORKDIR /root/

# install python pip and grpcio
#RUN pip install protobuf grpcio
#RUN pip install --no-cache-dir protobuf grpcio

# install golang
RUN apk add --no-cache go bash
Expand Down

0 comments on commit 4d819a1

Please sign in to comment.