From f9b3290571216f3339fa55e04dd3dda483deeb33 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Fri, 7 Oct 2022 14:00:31 +0200 Subject: [PATCH] feat(python): optimize Python layer by always building wheels (#10) Co-authored-by: Heitor Lessa --- layer/Python/Dockerfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/layer/Python/Dockerfile b/layer/Python/Dockerfile index 5541e04..7e6a979 100644 --- a/layer/Python/Dockerfile +++ b/layer/Python/Dockerfile @@ -12,7 +12,24 @@ WORKDIR /tmp RUN yum update -y && yum install -y zip unzip wget tar gzip binutils -RUN pip install -t /asset/python aws-lambda-powertools$PACKAGE_SUFFIX +# Install build essentials +RUN yum install -y \ + boost-devel \ + jemalloc-devel \ + bison \ + make \ + gcc \ + gcc-c++ \ + flex \ + autoconf \ + zip \ + git \ + ninja-build + +# Install cython to generate native code +RUN pip install --upgrade pip wheel && pip install --upgrade cython +# Optimize binary size and strip debugging symbols for optimum size +RUN CFLAGS="-Os -g0 -s" pip install --no-binary pydantic -t /asset/python aws-lambda-powertools$PACKAGE_SUFFIX # Removing nonessential files RUN cd /asset && \