forked from jwerre/node-canvas-lambda
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1023 Bytes
/
Copy pathDockerfile
File metadata and controls
40 lines (32 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM amazon/aws-lambda-nodejs:18
ARG OUT=/root/layers
ARG NODE_VERSION=18
# set up container
RUN yum -y update \
&& yum -y groupinstall "Development Tools" \
&& yum install -y \
nodejs \
python37 \
which \
binutils \
sed \
gcc-c++ \
cairo-devel \
libjpeg-turbo-devel \
pango-devel \
giflib-devel \
&& yum -y install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel
# will be created and become working dir
WORKDIR $OUT/nodejs
RUN npm install --build-from-source \
canvas@2.11.2 \
pdfjs-dist@4.4.168
# will be created and become working dir
WORKDIR $OUT/lib
# gather missing libraries
RUN curl https://raw.githubusercontent.com/ncopa/lddtree/v1.26/lddtree.sh -o $OUT/lddtree.sh \
&& chmod +x $OUT/lddtree.sh \
&& cp $($OUT/lddtree.sh -l $OUT/nodejs/node_modules/canvas/build/Release/canvas.node | grep '^\/lib' | sed -r -e '/canvas.node$/d') .
WORKDIR $OUT
# create a single zip file containing both nodejs and lib directories
RUN zip -r -9 node${NODE_VERSION}_canvas_layer.zip nodejs lib