Skip to content

Instantly share code, notes, and snippets.

@htr3n
Last active October 19, 2021 05:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htr3n/12ac5dff3b4d04d52ee1cc71243f94fd to your computer and use it in GitHub Desktop.
Save htr3n/12ac5dff3b4d04d52ee1cc71243f94fd to your computer and use it in GitHub Desktop.
node-canvas-lambda-container
FROM public.ecr.aws/lambda/nodejs:14
##
# Install necessary package for building Node.js Canvas
##
RUN yum -y update \
&& yum -y groupinstall "Development Tools" \
&& yum install -y nodejs gcc-c++ cairo-devel libjpeg-turbo-devel pango-devel giflib-devel zlib-devel librsvg2-devel
COPY *.js package* ./
RUN npm install --only=prod
ENV LD_PRELOAD=/var/task/node_modules/canvas/build/Release/libz.so.1
RUN yum remove -y cairo-devel libjpeg-turbo-devel pango-devel giflib-devel zlib-devel librsvg2-devel
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "index.handler" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment