There is no official aws lambda for nodejs with ubuntu... Here my grain of sand :b
217
Public images from AWS for lambda with nodejs are based on centos or fedora:
So, in this repository you will have a ready to use docker image with:
https://github.com/jrichardsz/aws-lambda-nodejs
docker pull jrichardsz/aws-lambda-nodejs:ubuntu-22-node-20.13.0
If you are concerned about the security, check all the files in this repository and build the image
docker build -t aws-lambda-nodejs:ubuntu-22-node-20.13.0 .
To build another images based on this, if your code is in /src , your Dockerfile should look like this
FROM aws-lambda-nodejs:ubuntu-22-node-20.13.0
ARG LAMBDA_TASK_ROOT="/app"
# Copy your function code
COPY ./src/ ${LAMBDA_TASK_ROOT}/
RUN npm install
docker build -t acme:1.0.0 .
docker run -it -p 8080:8080 acme:1.0.0
To try your lambda code in your localhost execute this
curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}' -v && echo
Content type
Image
Digest
sha256:18002e038…
Size
320.2 MB
Last updated
over 2 years ago
docker pull jrichardsz/aws-lambda-nodejs:ubuntu-22-node-20.13.0