you should use aws-lambda-rie (emulator) instead of aws-lambda-ric - docs.aws.amazon.com/lambda/latest/.... I believe that environment variable is set by AWS, so if it's not present that script will execute the emulator. This is an example
entry_script.sh
#!/bin/sh if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then exec /usr/local/bin/aws-lambda-rie /usr/local/bin/python -m awslambdaric $@ else exec /usr/local/bin/python -m awslambdaric $@ fi
Dockerfile
FROM python:3.9-bullseye ARG FUNCTION_DIR="/function" WORKDIR ${FUNCTION_DIR} RUN curl -Lo /usr/local/bin/aws-lambda-rie \ https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie && \ chmod +x /usr/local/bin/aws-lambda-rie COPY entry_script.sh ${FUNCTION_DIR} # Install dependencies RUN pip install \ --target ${FUNCTION_DIR} \ awslambdaric # Copy function code COPY src/* ${FUNCTION_DIR} ENTRYPOINT [ "sh", "entry_script.sh" ] CMD [ "app.handler" ]
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
you should use aws-lambda-rie (emulator) instead of aws-lambda-ric - docs.aws.amazon.com/lambda/latest/.... I believe that environment variable is set by AWS, so if it's not present that script will execute the emulator. This is an example
entry_script.sh
Dockerfile