-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
propagate cache option to docker builds
- Loading branch information
EC2 Default User
committed
Apr 23, 2024
1 parent
511c34e
commit b2e83ec
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
ARG PYTHON_VERSION=3.10 | ||
|
||
FROM --platform=linux/amd64 public.ecr.aws/lambda/python:${PYTHON_VERSION} | ||
|
||
WORKDIR /tmp | ||
|
||
COPY pyproject.toml pyproject.toml | ||
COPY LICENSE LICENSE | ||
COPY README.md README.md | ||
COPY titiler/ titiler/ | ||
|
||
# Install dependencies | ||
# 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 pip install --upgrade pip | ||
|
||
RUN pip install ".[cache]" "mangum>=0.10.0" "botocore==1.29.76" "aiobotocore==2.5.0" -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; | ||
RUN cd /asset && find . -type d -a -name '__pycache__' -print0 | xargs -0 rm -rf | ||
RUN cd /asset && find . -type f -a -name '*.py' -print0 | xargs -0 rm -f | ||
RUN find /asset -type d -a -name 'tests' -print0 | xargs -0 rm -rf | ||
RUN rm -rdf /asset/numpy/doc/ /asset/bin /asset/geos_license /asset/Misc | ||
RUN rm -rdf /asset/boto3* | ||
RUN rm -rdf /asset/botocore* | ||
|
||
COPY infrastructure/aws/lambda/handler.py /asset/handler.py | ||
|
||
CMD ["echo", "hello world"] |