forked from k-hui/puppeteer-aws-lambda-serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (24 loc) · 857 Bytes
/
Dockerfile
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
FROM public.ecr.aws/lambda/nodejs:16-x86_64 as development
WORKDIR /app
COPY tsconfig*.json ./
COPY package*.json ./
# skips puppeteer installing chrome and points to correct binary
ENV PUPPETEER_SKIP_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN npm ci
COPY src/ src/
RUN npm run build
FROM public.ecr.aws/lambda/nodejs:16-x86_64 as production
# Install Chrome to get all of the dependencies installed
RUN yum install -y amazon-linux-extras
RUN amazon-linux-extras install epel -y
RUN yum install -y chromium
WORKDIR /app
COPY package*.json ./
# skips puppeteer installing chrome and points to correct binary
ENV PUPPETEER_SKIP_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN npm ci --omit=dev
COPY --from=development /app/dist/ ./dist/
EXPOSE 3000
CMD [ "/app/dist/lambda.handler" ]