1 #!/bin/bash 2 3 set -e 4 5 # Strip some binaries that aren't already stripped, to save space. 6 find /usr/lib/ /usr/bin -type f | fgrep -v bazel | fgrep -v python | \ 7 xargs -P 32 -L 1 bash -c 'file "$0" | fgrep executable | fgrep -q stripped && strip --strip-unneeded "$0" || true' 8 9 # This was only needed above, we don't need it in the final image. 10 apt-get remove -y wget file python3-pip 11 apt-get autoremove -y 12 13 # Remove temporary files, to save space. 14 apt-get clean 15 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 16