-
Notifications
You must be signed in to change notification settings - Fork 1
/
step7.Dockerfile
45 lines (29 loc) · 1000 Bytes
/
step7.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
# Stage 0
FROM node:12-alpine as builder
ENV NO_UPDATE_NOTIFIER true
COPY package.json package-lock.json ./
RUN npm install --no-optional
COPY . .
RUN npm run build
# Stage 1
FROM node:12-alpine as installer
ENV NO_UPDATE_NOTIFIER true
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
COPY package.json package-lock.json ./
RUN npm install --no-bin-links --only=prod --no-optional --no-audit && \
chmod +x /tini && \
deluser --remove-home node && \
adduser --system --home /var/cache/bootapp --shell /sbin/nologin bootapp
# Stage 2
FROM gcr.io/distroless/nodejs-debian10:12
ENV NO_UPDATE_NOTIFIER true
WORKDIR /usr/src/app
COPY --from=installer /tini /tini
COPY --from=installer /etc/passwd /etc/shadow /etc/
COPY --from=installer node_modules ./node_modules
COPY --from=builder dist ./dist
# COPY --from=builder public ./public
USER bootapp
ENTRYPOINT ["/tini", "--"]
CMD [ "/nodejs/bin/node", "./dist/server.js" ]