diff --git a/Dockerfile b/Dockerfile index 7cd80c26..5cbd3ffd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,15 +100,14 @@ RUN pip install --quiet packaging && \ fi RUN find ./python/lib/$runtime/site-packages -name __pycache__ -type d -exec rm -r {} \+ -# When building ddtrace from branch, remove extra source files. These are -# removed by the ddtrace build process before publishing a wheel to PyPI. -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.c -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.cpp -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.cc -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.h -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.hpp -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.pyx -delete -RUN find ./python/lib/$runtime/site-packages/ddtrace -name \*.pyi -delete +# Remove C/C++/Cython sources and type stubs. Nothing imports them at runtime. +# ddtrace ships them when built from a branch, and other packages ship them +# in their release wheels (e.g. wrapt/_wrappers.c is ~150 kB, wrapt-stubs ~30 kB). +RUN find ./python/lib/$runtime/site-packages -type f \( \ + -name \*.c -o -name \*.cpp -o -name \*.cc -o -name \*.h -o -name \*.hpp \ + -o -name \*.pyx -o -name \*.pxd -o -name \*.pyi \ + \) -delete +RUN find ./python/lib/$runtime/site-packages -type d -empty -delete # Strip debug symbols and symbols that are not needed for relocation # processing using strip --strip-unneeded for all .so files. This is to