-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/lambda-docker' into 'master'
Deploy openEO-sh-driver as docker image on AWS lambda See merge request team-6/openeo-sentinelhub-python-driver!317
- Loading branch information
Showing
5 changed files
with
692 additions
and
174 deletions.
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,38 @@ | ||
# resources | ||
# https://www.cloudtechsimplified.com/run-docker-containers-images-from-ecr-in-aws-lambda-along-with-cicd-python/ | ||
# https://docs.aws.amazon.com/lambda/latest/dg/python-image.html#python-image-instructions | ||
# https://gallery.ecr.aws/lambda/python/ | ||
# https://zebradil.me/post/2018-05-25-pipenv-for-aws-lambda/ | ||
# https://stackoverflow.com/questions/48381918/how-do-i-install-git-using-aws-lambda | ||
# https://stackoverflow.com/a/68787552 | ||
# https://github.com/zappa/Zappa#docker-workflows | ||
# https://ianwhitestone.work/zappa-serverless-docker/ | ||
|
||
# use base aws lambda docker image for python (all the sources listed bellow) | ||
FROM public.ecr.aws/lambda/python:3.9 | ||
|
||
# install pipenv and git that are needed to install dependencies | ||
RUN yum -y install git | ||
RUN pip install pipenv | ||
|
||
# copy the /rest folder | ||
COPY ./ ${LAMBDA_TASK_ROOT} | ||
|
||
# create requirements.txt file and | ||
# install dependencies with pip | ||
RUN pipenv requirements > requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) | ||
# app.app is the same as in zappa_settings.json.template | ||
# CMD [ "app.app" ] | ||
|
||
# https://ianwhitestone.work/zappa-serverless-docker/ | ||
# Grab the zappa handler.py and put it in the working directory | ||
RUN ZAPPA_HANDLER_PATH=$( \ | ||
python -c "from zappa import handler; print (handler.__file__)" \ | ||
) \ | ||
&& echo $ZAPPA_HANDLER_PATH \ | ||
&& cp $ZAPPA_HANDLER_PATH ${LAMBDA_TASK_ROOT} | ||
|
||
CMD [ "handler.lambda_handler" ] |
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
Oops, something went wrong.