I am working on updating node js version from 16 to 20 for Aws lambda. We have a dockerfile which serve as base of this process. We have a dockerfile which has node 16 and works perfectly now i need help in creating a dockerfile that has aws cli, nodejs 20 and npm in it.
Dockerfile working file with node 16
FROM amazon/aws-cli:2.8.3
RUN yum update -y
&& curl --silent --location https://rpm.nodesource.com/setup_16.x | bash -
&& yum install -y nodejs-16.15.0 which zip
&& yum clean all
&& rm -rf /var/cache/yum
I have tried multiple things but nothing seems to work eg I tried the below dockerfile but it fails because aws cli internally ahd amazon linux:2 which has glibc version 2.26 and node 20 needs glibc version 2.28
dockerfile i tried which didn’t work
FROM amazon/aws-cli:2.8.3
RUN yum update -y
&& curl --silent --location https://rpm.nodesource.com/setup_20.x | bash -
&& yum install -y nodejs which zip
&& yum clean all
&& rm -rf /var/cache/yum
I even tried building image from scratch but was not successful
FROM public.ecr.aws/lambda/nodejs:20
FROM amazon/aws-cli:2.8.3
RUN yum update -y
&& yum clean all
&& rm -rf /var/cache/yum
so in short i need help in creating a dockerfile that has aws cli, nodejs 20 and npm in it.
I will be very grateful for any help in figuring this out