Skip to content

Commit

Permalink
fix Lambda docker build (#31)
Browse files Browse the repository at this point in the history
* update botocore, aiobotocore versions in Lambda Dockerfile

* pick versions of botocore and aiobotocore that are compatible with runtime env
  • Loading branch information
hrodmn authored Oct 15, 2024
1 parent e9a14c6 commit cde8188
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion infrastructure/aws/lambda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.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;
Expand Down

0 comments on commit cde8188

Please sign in to comment.