From c4d7e937a7871137cc1c29378c7073d5031d37d9 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Mon, 14 Oct 2024 15:10:54 -0500 Subject: [PATCH 1/2] update botocore, aiobotocore versions in Lambda Dockerfile --- infrastructure/aws/lambda/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infrastructure/aws/lambda/Dockerfile b/infrastructure/aws/lambda/Dockerfile index cfd0baf..c2bc4f0 100644 --- a/infrastructure/aws/lambda/Dockerfile +++ b/infrastructure/aws/lambda/Dockerfile @@ -10,13 +10,16 @@ COPY README.md README.md COPY titiler/ titiler/ # Install dependencies + +# Install system dependencies to compile (numexpr) +RUN yum install -y gcc-c++ # HACK: aiobotocore has a tight botocore dependency # https://github.com/aio-libs/aiobotocore/issues/862 # and becaise we NEED to remove both boto3 and botocore to save space for the package # we have to force using old package version that seems `almost` compatible with Lambda env botocore # https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html RUN python -m pip install --upgrade pip -RUN python -m pip install . "mangum>=0.10.0" "botocore==1.29.76" "aiobotocore==2.5.0" -t /asset --no-binary pydantic +RUN python -m pip install . "mangum>=0.10.0" "botocore==1.35.36" "aiobotocore==2.15.2" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done; From 403d2e69d07e6d148055f8721f192c9533c9c9b4 Mon Sep 17 00:00:00 2001 From: hrodmn Date: Tue, 15 Oct 2024 09:21:36 -0500 Subject: [PATCH 2/2] pick versions of botocore and aiobotocore that are compatible with runtime env --- infrastructure/aws/lambda/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/aws/lambda/Dockerfile b/infrastructure/aws/lambda/Dockerfile index c2bc4f0..c64b000 100644 --- a/infrastructure/aws/lambda/Dockerfile +++ b/infrastructure/aws/lambda/Dockerfile @@ -19,7 +19,7 @@ RUN yum install -y gcc-c++ # we have to force using old package version that seems `almost` compatible with Lambda env botocore # https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html RUN python -m pip install --upgrade pip -RUN python -m pip install . "mangum>=0.10.0" "botocore==1.35.36" "aiobotocore==2.15.2" -t /asset --no-binary pydantic +RUN python -m pip install . "mangum>=0.10.0" "botocore==1.34.145" "aiobotocore==2.13.3" -t /asset --no-binary pydantic # Reduce package size and remove useless files RUN cd /asset && find . -type f -name '*.pyc' | while read f; do n=$(echo $f | sed 's/__pycache__\///' | sed 's/.cpython-[0-9]*//'); cp $f $n; done;