Created
May 8, 2024 23:17
-
-
Save oscarnevarezleal/0cbd7ff8a2e58d28c610719b7da334f8 to your computer and use it in GitHub Desktop.
Custom CMD handler based on environment variables
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 | |
ARG HANDLER_PATH="src.entrypoints.listener.handler.handler" | |
ENV HANDLER_PATH="${HANDLER_PATH}" | |
#.... | |
ENTRYPOINT [ "./lambda-entrypoint.sh" ] |
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
#!/usr/bin/env bash | |
# shellcheck disable=SC2034 | |
export _HANDLER="${HANDLER_PATH}" | |
RUNTIME_ENTRYPOINT=/var/runtime/bootstrap | |
if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then | |
exec /usr/local/bin/aws-lambda-rie $RUNTIME_ENTRYPOINT | |
else | |
exec $RUNTIME_ENTRYPOINT | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment