aws / aws-lambda-runtime-interface-emulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation: Explain `<image entrypoint>`

kingram6865 opened this issue · comments

In the instructions there are some small pieces left out that make documentation difficult to understand.
This is one piece. What is the image entrypoint? I think it is wise not to assume people reading know what that is.

What are the minimum required ingredients to get this tool working?
What script names do I need to create in order to follow along with the instructions?

From what I can tell, the <image entrypoint> and <(optional) image command> refer to the original entrypoint and command you specified in your dockerfile when you built the container image. You have to re-specify them when using the rie because it needs to run its own entrypoint first. These are almost always going to be the entrypoint for the Runtime Interface Client for your language of choice.

So for example if you're using Node, you will probably have the following in your dockerfile:

RUN npm install aws-lambda-ric
ENTRYPOINT ["npx", "aws-lambda-ric"]
CMD ["index.handler"]

In that case, you should invoke the rie like this:

docker run -d \
    -v ~/.aws-lambda-rie:/aws-lambda \
    -p 9000:8080 \
    myfunction:latest \
    --entrypoint /aws-lambda/aws-lambda-rie \
    npx aws-lambda-ric \
    index.handler