Skip to content

Commit cb395ff

Browse files
authored
Disable pip cache when creating Docker images (#8575)
* This is a good practice to save storage space in the Docker images being created * Also sort pip package lists alphabetically
1 parent df06c58 commit cb395ff

13 files changed

+66
-8
lines changed

docker/Dockerfile.ci_arm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ FROM ubuntu:18.04
2323
RUN apt-get update --fix-missing
2424
RUN apt-get install -y ca-certificates gnupg2
2525

26+
# Globally disable pip cache
27+
RUN pip config set global.cache-dir false
28+
2629
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2730
RUN bash /install/ubuntu_install_core.sh
2831

docker/Dockerfile.ci_cpu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ FROM ubuntu:18.04
2121

2222
RUN apt-get update --fix-missing
2323

24+
# Globally disable pip cache
25+
RUN pip config set global.cache-dir false
26+
2427
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2528
RUN bash /install/ubuntu_install_core.sh
2629

docker/Dockerfile.ci_gpu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ FROM nvidia/cuda:11.0.3-cudnn8-devel-ubuntu18.04
2222
# Base scripts
2323
RUN apt-get update --fix-missing
2424

25+
# Globally disable pip cache
26+
RUN pip config set global.cache-dir false
27+
2528
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2629
RUN bash /install/ubuntu_install_core.sh
2730

docker/Dockerfile.ci_i386

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ FROM ioft/i386-ubuntu:16.04
2222

2323
RUN apt-get update --fix-missing && apt-get install -y ca-certificates
2424

25+
# Globally disable pip cache
26+
RUN pip config set global.cache-dir false
27+
2528
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2629
RUN bash /install/ubuntu_install_core.sh
2730

docker/Dockerfile.ci_lint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ FROM ubuntu:18.04
2222

2323
RUN apt-get update --fix-missing
2424

25+
# Globally disable pip cache
26+
RUN pip config set global.cache-dir false
27+
2528
RUN apt-get update && apt-get install -y wget git sudo make
2629

2730
COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh

docker/Dockerfile.ci_qemu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ FROM ubuntu:18.04
2121

2222
RUN apt-get update --fix-missing
2323

24+
# Globally disable pip cache
25+
RUN pip config set global.cache-dir false
26+
2427
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2528
RUN bash /install/ubuntu_install_core.sh
2629

docker/Dockerfile.ci_wasm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ FROM ubuntu:18.04
1818

1919
RUN apt-get update --fix-missing
2020

21+
# Globally disable pip cache
22+
RUN pip config set global.cache-dir false
23+
2124
COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
2225
RUN bash /install/ubuntu_install_core.sh
2326

docker/install/ubuntu_install_darknet.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ set -o pipefail
2323
#install the necessary dependancies, cffi, opencv
2424
wget -q 'https://github.com/siju-samuel/darknet/blob/master/lib/libdarknet.so?raw=true' -O libdarknet.so
2525
debian_version=`cat /etc/debian_version`
26-
pip3 install opencv-python cffi
26+
27+
pip3 install \
28+
cffi \
29+
opencv-python

docker/install/ubuntu_install_onnx.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ set -o pipefail
2222

2323
# We need to fix the onnx version because changing versions tends to break tests
2424
# TODO(mbrookhart): periodically update
25-
pip3 install onnx==1.8.1
26-
pip3 install onnxruntime==1.7.0
25+
pip3 install \
26+
onnx==1.8.1 \
27+
onnxruntime==1.7.0
2728

2829
# torch depends on a number of other packages, but unhelpfully, does
2930
# not expose that in the wheel!!!
3031
pip3 install future
3132

32-
pip3 install torch==1.7.0 torchvision==0.8.1
33+
pip3 install \
34+
torch==1.7.0 \
35+
torchvision==0.8.1

docker/install/ubuntu_install_python_package.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,21 @@ set -u
2121
set -o pipefail
2222

2323
# install libraries for python package on ubuntu
24-
pip3 install six numpy pytest cython decorator scipy tornado pytest pytest-xdist pytest-profiling mypy orderedset attrs requests Pillow packaging cloudpickle synr
24+
pip3 install \
25+
attrs \
26+
cloudpickle \
27+
cython \
28+
decorator \
29+
mypy \
30+
numpy \
31+
orderedset \
32+
packaging \
33+
Pillow \
34+
pytest \
35+
pytest-profiling \
36+
pytest-xdist \
37+
requests \
38+
scipy \
39+
six \
40+
synr \
41+
tornado

0 commit comments

Comments
 (0)