On https://github.com/T145/black-mirror/blob/master/Dockerfile#L55 , I ran the following command to reduce executable sizes:
find -P -O3 /usr/bin/ /usr/local/bin -type f -not -name strip -and -not -name dbus-daemon -execdir strip -v --strip-unneeded '{}' \;
And its size jumped up from ~779.53 to ~986.55MB!
As an attempt to bypass this caveat I created an intermediate layer to copy the changes over from, like so:
FROM base as stripped
RUN find -P -O3 /usr/bin/ /usr/local/bin -type f -not -name strip -and -not -name dbus-daemon -execdir strip -v --strip-unneeded '{}' ;
FROM base
COPY --from=stripped /usr/bin/ /usr/bin/
COPY --from=stripped /usr/local/bin/ /usr/local/bin/
However the resulting image size did not change. Also note that the base
image has other programs installed on it, so simply using another Debian distribution as the intermediate layer wouldn't cover stripping each program on the base image.
Why is this large size difference happening? Is there a way to strip executables in Docker at all without having this happen?