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

Commit 4d819a1

Browse files
committed
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 <[email protected]>
1 parent 2d6fd35 commit 4d819a1

File tree

2 files changed

+4
-4
lines changed
  • applications/openvino/benchmark
  • iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile

2 files changed

+4
-4
lines changed

applications/openvino/benchmark/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RUN wget $OPENVINO_LINK && \
5151
rm -rf /tmp/l_openvino_toolkit* && \
5252
ln --symbolic /opt/intel/openvino_"$YEAR"/ /opt/intel/openvino
5353

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

7272
WORKDIR /opt/intel/openvino_$YEAR/deployment_tools/open_model_zoo/tools/downloader
73-
RUN pip3 install pyyaml requests
73+
RUN pip3 install --no-cache-dir pyyaml requests
7474
RUN ./downloader.py --name face-detection-retail-0004
7575
RUN ./downloader.py --name squeezenet1.1
7676
RUN ./downloader.py --name semantic-segmentation-adas-0001

iot-gateway/baidu-openedge/scripts/ansible/examples/setup_baidu_openedge/composefile/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN python3.6 get-pip.py
3131

3232
# needed by openedge when build
3333
RUN apk add --no-cache zip unzip tcpdump
34-
RUN pip3 install protobuf
34+
RUN pip3 install --no-cache-dir protobuf
3535

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

4747
# install python pip and grpcio
48-
#RUN pip install protobuf grpcio
48+
#RUN pip install --no-cache-dir protobuf grpcio
4949

5050
# install golang
5151
RUN apk add --no-cache go bash

0 commit comments

Comments
 (0)