-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (35 loc) · 1.05 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
FROM public.ecr.aws/lambda/nodejs:18 as builder
RUN yum update -y && \
yum groupinstall "Development Tools" -y && \
yum install python3 -y
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY ./lib ./lib
COPY ./bin ./bin
COPY ./handlers ./handlers
COPY ./tsconfig.json ./
RUN node --loader ts-node/esm ./bin/gen-handlers-entry.ts
COPY ./tsconfig.json ./*.ts ./
RUN npm run build
FROM public.ecr.aws/lambda/nodejs:18 as runtime
RUN yum update -y && \
yum groupinstall "Development Tools" -y && \
yum install python3 -y
WORKDIR /usr/app
COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts
RUN npm install @mapbox/node-pre-gyp
RUN npm rebuild --build-from-source opencc
## the actual run image
FROM public.ecr.aws/lambda/nodejs:18
RUN yum update -y && \
yum install postgresql -y
ENV NODE_OPTIONS="--trace-warnings"
WORKDIR ${LAMBDA_TASK_ROOT}
## for ESM module at run-time
COPY package.json ./
COPY ./sql/ ./sql/
COPY --from=runtime /usr/app/node_modules/ ./node_modules/
COPY --from=builder /usr/app/dist/ ./
CMD ["indexer.handler"]