From 1ad40fcfa5b2a4fea546b76acb2e6fb80d1712e3 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Thu, 19 Mar 2026 13:01:01 +0100 Subject: [PATCH 1/5] Remove more things from the ddtrace package Signed-off-by: Juanjo Alvarez --- Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b64cd419..20625b41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,15 @@ RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_ast/iastpatc RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/_vendor RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/*.so RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so +RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/internal/test_visibility +RUN find ./python/lib/$runtime/site-packages -name "CMakeLists.txt" -delete +RUN find ./python/lib/$runtime/site-packages -name "*.pyi" -delete +RUN find ./python/lib/$runtime/site-packages -name "*.md" -delete +RUN find ./python/lib/$runtime/site-packages -name "*.sh" -delete +# Dogshell +RUN rm -rf ./python/lib/$runtime/site-packages/datadog/dogshell +RUN rm -rf ./python/lib/$runtime/site-packages/bin/dog* + # remove *.dist-info directories except any entry_points.txt files and METADATA files required for Appsec Software Composition Analysis RUN find ./python/lib/$runtime/site-packages/*.dist-info \ -type f \ @@ -50,7 +59,8 @@ RUN rm -rf \ ./python/lib/$runtime/site-packages/urllib3* \ ./python/lib/$runtime/site-packages/certifi* \ ./python/lib/$runtime/site-packages/idna* \ - ./python/lib/$runtime/site-packages/charset_normalizer* + ./python/lib/$runtime/site-packages/charset_normalizer* \ + ./python/lib/$runtime/site-packages/*__mypyc*.so # from charset_normalizer # Precompile all .pyc files and remove .py files. This speeds up load time. # Compile with optimization level 2 (-OO) and PYTHONNODEBUGRANGES=1 to redtce From 1ed66d7780800462775c3b588c774296ebfed149 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Thu, 19 Mar 2026 13:04:53 +0100 Subject: [PATCH 2/5] simplify appsec removal Signed-off-by: Juanjo Alvarez --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20625b41..2e5280fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,10 +33,7 @@ RUN pip install --no-cache-dir . -t ./python/lib/$runtime/site-packages RUN rm -rf ./python/lib/$runtime/site-packages/botocore* RUN rm -rf ./python/lib/$runtime/site-packages/setuptools RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests -RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_ast/iastpatch*.so -RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/_vendor -RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/*.so -RUN rm -f ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so +RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/internal/test_visibility RUN find ./python/lib/$runtime/site-packages -name "CMakeLists.txt" -delete RUN find ./python/lib/$runtime/site-packages -name "*.pyi" -delete From 93545f6754b7996d3fba287c1934a4fcf5f04c3d Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Thu, 19 Mar 2026 13:33:35 +0100 Subject: [PATCH 3/5] simplify appsec removal Signed-off-by: Juanjo Alvarez --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2e5280fb..c6cb2a3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ RUN pip install --no-cache-dir . -t ./python/lib/$runtime/site-packages RUN rm -rf ./python/lib/$runtime/site-packages/botocore* RUN rm -rf ./python/lib/$runtime/site-packages/setuptools RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests -RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec +RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/internal/test_visibility RUN find ./python/lib/$runtime/site-packages -name "CMakeLists.txt" -delete RUN find ./python/lib/$runtime/site-packages -name "*.pyi" -delete From 22fcc3d5b476c203b1e52074a94256903cedcdfc Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Thu, 19 Mar 2026 13:58:41 +0100 Subject: [PATCH 4/5] Add more extensions to delete Signed-off-by: Juanjo Alvarez --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index c6cb2a3e..b134b75b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,6 +39,8 @@ RUN find ./python/lib/$runtime/site-packages -name "CMakeLists.txt" -delete RUN find ./python/lib/$runtime/site-packages -name "*.pyi" -delete RUN find ./python/lib/$runtime/site-packages -name "*.md" -delete RUN find ./python/lib/$runtime/site-packages -name "*.sh" -delete +RUN find ./python/lib/$runtime/site-packages -name "*.cmake" -delete +RUN find ./python/lib/$runtime/site-packages -name "*.pxd" -delete # Dogshell RUN rm -rf ./python/lib/$runtime/site-packages/datadog/dogshell RUN rm -rf ./python/lib/$runtime/site-packages/bin/dog* From 068f833280cc9fc2d8bc87126757dd74527d9d79 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Thu, 19 Mar 2026 17:03:46 +0100 Subject: [PATCH 5/5] simplify appsec removal Signed-off-by: Juanjo Alvarez --- Dockerfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index b134b75b..f2ec66a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,12 +35,6 @@ RUN rm -rf ./python/lib/$runtime/site-packages/setuptools RUN rm -rf ./python/lib/$runtime/site-packages/jsonschema/tests RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast RUN rm -rf ./python/lib/$runtime/site-packages/ddtrace/internal/test_visibility -RUN find ./python/lib/$runtime/site-packages -name "CMakeLists.txt" -delete -RUN find ./python/lib/$runtime/site-packages -name "*.pyi" -delete -RUN find ./python/lib/$runtime/site-packages -name "*.md" -delete -RUN find ./python/lib/$runtime/site-packages -name "*.sh" -delete -RUN find ./python/lib/$runtime/site-packages -name "*.cmake" -delete -RUN find ./python/lib/$runtime/site-packages -name "*.pxd" -delete # Dogshell RUN rm -rf ./python/lib/$runtime/site-packages/datadog/dogshell RUN rm -rf ./python/lib/$runtime/site-packages/bin/dog*