aboutsummaryrefslogtreecommitdiff
path: root/extras/dockerfiles/common_cleanup.sh
blob: a02258a12413b147dd2d502b9e91c4f9de117be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

set -e

# Strip some binaries that aren't already stripped, to save space.
for f in $(find /usr/lib/ /usr/bin -type f | fgrep -v bazel | fgrep -v python)
do
  if file "$f" | fgrep 'executable' | fgrep -q 'stripped'
  then
    strip --strip-unneeded $f
  fi
done

# This was only needed above, we don't need it in the final image.
apt-get remove -y wget file python3-pip
apt-get autoremove -y

# Remove temporary files, to save space.
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*