Skip to content

Commit da0c31c

Browse files
zhengruifengdongjoon-hyun
authored andcommitted
[SPARK-46745][INFRA] Purge pip cache in dockerfile
### What changes were proposed in this pull request? Purge pip cache in dockerfile ### Why are the changes needed? to save 4~5G disk space: before https://github.com/zhengruifeng/spark/actions/runs/7541725028/job/20530432798 ``` #45 [39/39] RUN df -h #45 0.090 Filesystem Size Used Avail Use% Mounted on #45 0.090 overlay 84G 70G 15G 83% / #45 0.090 tmpfs 64M 0 64M 0% /dev #45 0.090 shm 64M 0 64M 0% /dev/shm #45 0.090 /dev/root 84G 70G 15G 83% /etc/resolv.conf #45 0.090 tmpfs 7.9G 0 7.9G 0% /proc/acpi #45 0.090 tmpfs 7.9G 0 7.9G 0% /sys/firmware #45 0.090 tmpfs 7.9G 0 7.9G 0% /proc/scsi #45 DONE 2.0s ``` after https://github.com/zhengruifeng/spark/actions/runs/7549204209/job/20552796796 ``` #48 [42/43] RUN python3.12 -m pip cache purge #48 0.670 Files removed: 392 #48 DONE 0.7s #49 [43/43] RUN df -h #49 0.075 Filesystem Size Used Avail Use% Mounted on #49 0.075 overlay 84G 65G 19G 79% / #49 0.075 tmpfs 64M 0 64M 0% /dev #49 0.075 shm 64M 0 64M 0% /dev/shm #49 0.075 /dev/root 84G 65G 19G 79% /etc/resolv.conf #49 0.075 tmpfs 7.9G 0 7.9G 0% /proc/acpi #49 0.075 tmpfs 7.9G 0 7.9G 0% /sys/firmware #49 0.075 tmpfs 7.9G 0 7.9G 0% /proc/scsi ``` ### Does this PR introduce _any_ user-facing change? no, infra-only ### How was this patch tested? ci ### Was this patch authored or co-authored using generative AI tooling? no Closes #44768 from zhengruifeng/infra_docker_cleanup. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
1 parent 44d2c86 commit da0c31c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/build_and_test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,6 @@ jobs:
417417
- name: Free up disk space
418418
shell: 'script -q -e -c "bash {0}"'
419419
run: |
420-
if [[ "$MODULES_TO_TEST" != *"pyspark-ml"* ]] && [[ "$BRANCH" != "branch-3.5" ]]; then
421-
# uninstall libraries dedicated for ML testing
422-
python3.9 -m pip uninstall -y torch torchvision torcheval torchtnt tensorboard mlflow deepspeed
423-
fi
424420
if [ -f ./dev/free_disk_space_container ]; then
425421
./dev/free_disk_space_container
426422
fi

dev/infra/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# See also in https://hub.docker.com/_/ubuntu
2020
FROM ubuntu:focal-20221019
2121

22-
ENV FULL_REFRESH_DATE 20231117
22+
ENV FULL_REFRESH_DATE 20240117
2323

2424
ENV DEBIAN_FRONTEND noninteractive
2525
ENV DEBCONF_NONINTERACTIVE_SEEN true
@@ -104,6 +104,7 @@ RUN python3.9 -m pip install $BASIC_PIP_PKGS unittest-xml-reporting $CONNECT_PIP
104104
# Add torch as a testing dependency for TorchDistributor and DeepspeedTorchDistributor
105105
RUN python3.9 -m pip install 'torch<=2.0.1' torchvision --index-url https://download.pytorch.org/whl/cpu
106106
RUN python3.9 -m pip install deepspeed torcheval
107+
RUN python3.9 -m pip cache purge
107108

108109
# Install Python 3.10 at the last stage to avoid breaking Python 3.9
109110
RUN add-apt-repository ppa:deadsnakes/ppa
@@ -114,6 +115,7 @@ RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
114115
RUN python3.10 -m pip install $BASIC_PIP_PKGS unittest-xml-reporting $CONNECT_PIP_PKGS
115116
RUN python3.10 -m pip install 'torch<=2.0.1' torchvision --index-url https://download.pytorch.org/whl/cpu
116117
RUN python3.10 -m pip install deepspeed torcheval
118+
RUN python3.10 -m pip cache purge
117119

118120
# Install Python 3.11 at the last stage to avoid breaking the existing Python installations
119121
RUN add-apt-repository ppa:deadsnakes/ppa
@@ -124,6 +126,7 @@ RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
124126
RUN python3.11 -m pip install $BASIC_PIP_PKGS unittest-xml-reporting $CONNECT_PIP_PKGS
125127
RUN python3.11 -m pip install 'torch<=2.0.1' torchvision --index-url https://download.pytorch.org/whl/cpu
126128
RUN python3.11 -m pip install deepspeed torcheval
129+
RUN python3.11 -m pip cache purge
127130

128131
# Install Python 3.12 at the last stage to avoid breaking the existing Python installations
129132
RUN add-apt-repository ppa:deadsnakes/ppa
@@ -137,3 +140,6 @@ RUN python3.12 -m pip install $BASIC_PIP_PKGS $CONNECT_PIP_PKGS lxml
137140
RUN python3.12 -m pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
138141
RUN python3.12 -m pip install torchvision --index-url https://download.pytorch.org/whl/cpu
139142
RUN python3.12 -m pip install torcheval
143+
RUN python3.12 -m pip cache purge
144+
145+
RUN df -h

0 commit comments

Comments
 (0)