I think the equivalent for ubuntu, on Amazon Linux 2 (lambda is using it) would be:
FROM public.ecr.aws/lambda/nodejs:14
COPY index.js package.json cad/ ${LAMBDA_TASK_ROOT}
RUN yum install -y libgl1-mesa-devel libx11-devel mesa-libGL-devel
RUN npm install
CMD ["index.handler"]
Answer from Marcin on Stack OverflowUsing temporary folders with AWS Lambda
Sure, no problem. But /tmp is only 512 MB in a Lambda function, so keep that in mind...
https://docs.aws.amazon.com/lambda/latest/dg/limits.html
Since memory can be much higher (up to 3GB) you may just want to use memory constructs to hold your data.
More on reddit.comAWS Lambda - Python 3.6, pyodbc, and SQL Server driver - ODBC driver
Just to clarify, it works on your ec2 instance but not on your lambda? If so, I would go over https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html On how to build the lambda deployment package. I recommend using virtualenv. You can also then go into the lambda console and start debugging once you've uploaded it. It might be useful to show your directory structure for your zip as well.
More on reddit.com