-
Notifications
You must be signed in to change notification settings - Fork 958
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup useless files for each image layers
- Loading branch information
Showing
3 changed files
with
65 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
# | ||
# This scripts should be called at the end of each RUN command | ||
# in the Dockerfiles. | ||
# | ||
# Each RUN command creates a new layer that is stored separately. | ||
# At the end of each command, we should ensure we clean up downloaded | ||
# archives and source files used to produce binary to reduce the size | ||
# of the layer. | ||
set -e | ||
set -x | ||
|
||
# Delete files that pip caches when installing a package. | ||
rm -rf /root/.cache/pip/* | ||
# Delete old downloaded archive files | ||
apt-get autoremove -y | ||
# Delete downloaded archive files | ||
apt-get clean | ||
# Delete source files used for building binaries | ||
rm -rf /usr/local/src/* | ||
# Delete conda downloaded tarballs | ||
conda clean -y --tarballs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters