Skip to content

Commit 28a49f1

Browse files
authored
1 parent 3081b5b commit 28a49f1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

tpu/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ ADD patches/kaggle_datasets.py /root/.local/lib/${PYTHON_VERSION_PATH}/site-pack
2828
# Prereqs
2929
# This is needed for cv2 (opencv-python):
3030
# https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo
31-
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
31+
RUN /tmp/clean-layer.sh && \
32+
apt-get update && apt-get install ffmpeg libsm6 libxext6 -y && \
33+
/tmp/clean-layer.sh
3234

3335
# Install all the packages together for maximum compatibility.
3436
# Additional useful packages should be added in the requirements.txt

tpu/clean-layer.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ apt-get clean
1919
# Ensures the current working directory won't be deleted
2020
cd /usr/local/src/
2121
# Delete source files used for building binaries
22-
rm -rf /usr/local/src/*
22+
rm -rf /usr/local/src/*
23+
24+
# More clean up to save disk space
25+
rm -rf /var/lib/apt/lists/*
26+
find /tmp -mindepth 1 ! -name 'clean-layer.sh' -delete 2>/dev/null || true
27+
rm -rf /root/.cache
28+
rm -rf /var/cache/apt/archives/*
29+
find /usr -name '*.pyc' -delete 2>/dev/null || true
30+
find /usr -name '__pycache__' -type d -exec rm -rf {} + 2>/dev/null || true

0 commit comments

Comments
 (0)