Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Lambda docker build #31

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and are those version compatible with the version of s3fs pinned in pyproject.toml ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. I landed on these versions by using uv (outside of the docker container) to resolve the versions given boto3==1.34.145 and botocore==1.34.145.

henry@quercus:/tmp/test$ uv pip install --no-cache . "mangum>=0.10.0" "boto3==1.34.145" "botocore==1.34.145" aiobotocore --no-binary pydantic
Resolved 81 packages in 1.64s
   Built titiler-cmr @ file:///tmp/test
   Built pydantic==2.9.2
Prepared 81 packages in 11.14s
Installed 81 packages in 43ms
 + affine==2.4.0
 + aiobotocore==2.13.3
 + aiohappyeyeballs==2.4.3
 + aiohttp==3.10.10
 + aioitertools==0.12.0
 + aiosignal==1.3.1
 + annotated-types==0.7.0
 + anyio==4.6.2.post1
 + attrs==24.2.0
 + boto3==1.34.145
 + botocore==1.34.145
 + bounded-pool-executor==0.0.3
 + cachetools==5.5.0
 + certifi==2024.8.30
 + cftime==1.6.4
 + charset-normalizer==3.4.0
 + ciso8601==2.3.1
 + click==8.1.7
 + click-plugins==1.1.1
 + cligj==0.7.2
 + cogeo-mosaic==7.2.0
 + color-operations==0.1.6
 + earthaccess==0.11.0
 + fastapi==0.115.2
 + frozenlist==1.4.1
 + fsspec==2024.9.0
 + geojson-pydantic==1.1.1
 + h11==0.14.0
 + h5netcdf==1.1.0
 + h5py==3.12.1
 + httpcore==1.0.6
 + httpx==0.27.2
 + idna==3.10
 + importlib-resources==6.4.5
 + jinja2==3.1.4
 + jmespath==1.0.1
 + mangum==0.19.0
 + markupsafe==3.0.1
 + morecantile==5.4.2
 + multidict==6.1.0
 + multimethod==1.12
 + numexpr==2.10.1
 + numpy==2.1.2
 + orjson==3.10.7
 + packaging==24.1
 + pandas==2.2.3
 + pqdm==0.2.0
 + propcache==0.2.0
 + pydantic==2.9.2
 + pydantic-core==2.23.4
 + pydantic-settings==2.5.2
 + pyparsing==3.2.0
 + pyproj==3.7.0
 + pystac==1.11.0
 + python-cmr==0.13.0
 + python-dateutil==2.9.0.post0
 + python-dotenv==1.0.1
 + pytz==2024.2
 + rasterio==1.4.1
 + requests==2.32.3
 + rio-tiler==6.7.0
 + rioxarray==0.13.4
 + s3fs==2024.9.0
 + s3transfer==0.10.3
 + shapely==2.0.6
 + simplejson==3.19.3
 + six==1.16.0
 + sniffio==1.3.1
 + starlette==0.40.0
 + supermorecado==0.1.2
 + tinynetrc==1.3.1
 + titiler-cmr==0.1.dev0 (from file:///tmp/test)
 + titiler-core==0.18.9
 + titiler-mosaic==0.18.9
 + tqdm==4.66.5
 + typing-extensions==4.12.2
 + tzdata==2024.2
 + urllib3==2.2.3
 + wrapt==1.16.0
 + xarray==2024.9.0
 + yarl==1.15.2


# 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
Loading