1#!/bin/bash 2 3set -e 4 5# Strip some binaries that aren't already stripped, to save space. 6find /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. 10apt-get remove -y wget file python3-pip 11apt-get autoremove -y 12 13# Remove temporary files, to save space. 14apt-get clean 15rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 16