I have read extensively about this mysterious lambda-entrypoint.sh. Apparently it is part of the lambda base image and neeeds to be referenced/invoked in the Dockerfile ?
But I can not find a working template for it. Here is my Dockerfile and the results of using it to run a Containerized Lambda function:
# Use the official Python runtime as a parent image
FROM public.ecr.aws/lambda/python:3.11
WORKDIR /var/task
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY service /var/task/service
COPY lambda_function.py .
COPY *.py .
CMD ["lambda_function.lambda_handler"]
ENTRYPOINT ["/lambda-entrypoint.sh"]
The build command is:
docker build --platform linux/amd64 -t 123456.dkr.ecr.us-east-1.amazonaws.com/cdk-hnb659fds-container-assets-7890-us-east-1:my-user-metrics6 .
Here is the output of running a test event:
{
"errorType": "Runtime.InvalidEntrypoint",
"errorMessage": "RequestId: 8ba540c9-9877-4a90-b094-e2836fd0bbc4 Error: fork/exec /lambda-entrypoint.sh: exec format error"
}