From 109953c92998cdf1817a9c1833ec1170eb6bee62 Mon Sep 17 00:00:00 2001 From: Pratik raj Date: Fri, 11 Dec 2020 10:16:35 +0530 Subject: [PATCH] use `--no-cache-dir` flag to `pip` in dockerfiles to save space 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 --- applications/openvino/benchmark/Dockerfile | 4 ++-- .../examples/setup_baidu_openedge/composefile/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/openvino/benchmark/Dockerfile b/applications/openvino/benchmark/Dockerfile index 51c2938f..3c4f5216 100644 --- a/applications/openvino/benchmark/Dockerfile +++ b/applications/openvino/benchmark/Dockerfile @@ -40,14 +40,14 @@ RUN $INSTALL_DIR/install_dependencies/install_openvino_dependencies.sh RUN mkdir $INSTALL_DIR/deployment_tools/inference_engine/samples/cpp/build WORKDIR $INSTALL_DIR/deployment_tools/inference_engine/samples/cpp/build RUN /bin/bash -c "source $INSTALL_DIR/bin/setupvars.sh && cmake .. && make -j1" -RUN pip3 install networkx==2.3 +RUN pip3 install --no-cache-dir networkx==2.3 WORKDIR /opt/intel/openvino/deployment_tools/demo RUN /bin/bash -c "source $INSTALL_DIR/bin/setupvars.sh && ./demo_squeezenet_download_convert_run.sh" #Download OpenVINO pre-trained models -RUN pip3 install pyyaml requests +RUN pip3 install --no-cache-dir pyyaml requests WORKDIR /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader RUN ./downloader.py --name face-detection-retail-0004 RUN ./downloader.py --name squeezenet1.1 diff --git a/iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile/Dockerfile b/iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile/Dockerfile index e629e8ea..f88394a4 100644 --- a/iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile/Dockerfile +++ b/iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile/Dockerfile @@ -11,7 +11,7 @@ RUN yum install -y python36-pip # needed by openedge when build RUN yum install -y zip unzip tcpdump -RUN pip3 install grpcio protobuf pyyaml +RUN pip3 install --no-cache-dir grpcio protobuf pyyaml #RUN yum install -y wget python iputils-ping python-pip openssh-server expect iperf3 net-tools openssh-clients psmisc @@ -21,7 +21,7 @@ RUN yum install -y make git WORKDIR /root/ # install python pip and grpcio -#RUN pip install protobuf grpcio +#RUN pip install --no-cache-dir protobuf grpcio # install golang RUN wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz