Last active
September 14, 2022 05:58
-
-
Save mu373/c177c77863085b3205cec012eab0ce35 to your computer and use it in GitHub Desktop.
AWS Lambda container on Docker template
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
def handler(event, context): | |
return 'Hello from AWS Lambda using Python!' |
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
version: "3.6" | |
services: | |
lambda: | |
container_name: lambda | |
build: . | |
volumes: | |
- $HOME/.aws/:/root/.aws/ | |
ports: | |
- "9000:8080" | |
env_file: | |
- .env.local |
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
FROM public.ecr.aws/lambda/python:3.9 | |
# Copy function code | |
COPY app.py ${LAMBDA_TASK_ROOT} | |
# Install the function's dependencies using file requirements.txt | |
# from your project folder. | |
COPY requirements.txt . | |
RUN pip3 install -r requirements.txt --target "${LAMBDA_TASK_ROOT}" | |
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) | |
CMD [ "app.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
# some additional libraries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
c.f. https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/python-image.html