-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (22 loc) · 816 Bytes
/
Dockerfile
File metadata and controls
36 lines (22 loc) · 816 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
FROM node:14-alpine As build
WORKDIR /usr/src/app
COPY ["package.json", "yarn.lock", "./"]
RUN yarn install --frozen-lockfile
FROM build as prod-deps
# Prune unused dependencies
RUN npm prune --production
FROM alpine:3.15 as reference
WORKDIR /usr/src/app
RUN apk update &&\
apk add --no-cache curl tar xz
RUN curl -SLO "https://upload.cppreference.com/mwiki/images/1/16/html_book_20190607.tar.xz" &&\
tar -xf html_book_20190607.tar.xz reference --checkpoint=.100 &&\
rm html_book_20190607.tar.xz
FROM node:14-alpine
USER node
WORKDIR /usr/src/app
ENV NODE_ENV production
COPY --chown=node:node --from=prod-deps /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=reference /usr/src/app/reference ./reference
COPY --chown=node:node ./index.js ./index.js
CMD node index.js