Skip to content

Commit

Permalink
feat: Reduce size limits, remove experimental ddtrace bins (#445)
Browse files Browse the repository at this point in the history
* feat: Reduce size limits, strip unused ddtrace bins

* feat: 13m?

* feat: Lower zipped

* feat: 4mb zipped then

* feat: remove urllib3
  • Loading branch information
astuyve committed Mar 12, 2024
1 parent 20a2e4e commit 7e1fa70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ RUN pip install . -t ./python/lib/$runtime/site-packages
# Remove *.pyc files
RUN find ./python/lib/$runtime/site-packages -name \*.pyc -delete

# Strip symbols from ddtrace's binaries.
# TODO (AJ): remove when ddtrace fixes this upstream
RUN find . -name '*.so' -exec strip -g {} \;

# Remove botocore (40MB) to reduce package size. aws-xray-sdk
# installs it, while it's already provided by the Lambda Runtime.
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 find . -name 'libddwaf.so' -delete
RUN rm -rf ./python/lib/$runtime/site-packages/urllib3
RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_taint_tracking/*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/appsec/_iast/_stacktrace*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/libdd_wrapper.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/ddup/_ddup.*.so
RUN rm ./python/lib/$runtime/site-packages/ddtrace/internal/datadog/profiling/stack_v2/_stack_v2.*.so

FROM scratch
COPY --from=builder /build/python /
4 changes: 2 additions & 2 deletions scripts/check_layer_size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

# 7 mb size limit
set -e
MAX_LAYER_COMPRESSED_SIZE_KB=$(expr 7 \* 1024)
MAX_LAYER_UNCOMPRESSED_SIZE_KB=$(expr 24 \* 1024)
MAX_LAYER_COMPRESSED_SIZE_KB=$(expr 4 \* 1024)
MAX_LAYER_UNCOMPRESSED_SIZE_KB=$(expr 13 \* 1024)


LAYER_FILES_PREFIX="datadog_lambda_py"
Expand Down

0 comments on commit 7e1fa70

Please sign in to comment.