-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
47 lines (45 loc) · 1.61 KB
/
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
40
41
42
43
44
45
46
47
# Define function directory
ARG FUNCTION_DIR="/function"
# Build Stage 1: Install aws-lambda-ric dependencies, npm install package.json dependencies
FROM node:14-buster as build-image
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# AWS Lambda runtime dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
make \
unzip \
libcurl4-openssl-dev \
autoconf \
libtool \
cmake
# Copy function code
RUN mkdir -p ${FUNCTION_DIR}/
COPY app/ ${FUNCTION_DIR}
RUN ls ${FUNCTION_DIR}
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR ${FUNCTION_DIR}
RUN npm install
# Build Stage 2: Copy Build Stage 1 files in to Stage 2. Install chromium dependencies and chromium.
FROM node:14-buster-slim
# Include global arg in this stage of the build
ARG FUNCTION_DIR
# Set working directory to function root directory
WORKDIR ${FUNCTION_DIR}
# Copy in the build image dependencies
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
RUN ls ${FUNCTION_DIR}
# Install chromium and dependencies
RUN apt-get update \
&& apt-get install -y wget gnupg chromium mesa-va-drivers libva-drm2 libva-x11-2 mesa-utils mesa-utils-extra \
&& apt-get update \
&& apt-get install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
ADD aws-lambda-rie /usr/local/bin/aws-lambda-rie
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod u+x /usr/local/bin/entrypoint.sh
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
ENV HOME="/tmp"
CMD [ "/function/app.lambdaHandler" ]