Skip to content
This repository was archived by the owner on Dec 2, 2023. It is now read-only.

Commit d3eb8ce

Browse files
committed
feat(docker): change to use distoless/nodejs
1 parent aa97e09 commit d3eb8ce

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
node_modules
2-
.idea
3-
yarn-error.log
1+
.git/
2+
.idea/
3+
dist/
4+
node_modules/

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@ FROM node:16-alpine AS builder
22
WORKDIR /app
33

44
COPY package.json yarn.lock ./
5-
RUN yarn install --frozen-lockfile --production=false
5+
RUN yarn install --non-interactive --frozen-lockfile
66

77
COPY . .
88

99
RUN yarn build
10-
RUN npm prune --production
11-
RUN yarn cache clean
1210

13-
FROM node:16-alpine
11+
# ---
12+
13+
FROM node:16-alpine AS node_modules
14+
WORKDIR /app
15+
16+
COPY package.json yarn.lock ./
17+
RUN yarn install --non-interactive --frozen-lockfile --prod
18+
19+
# ---
20+
21+
FROM gcr.io/distroless/nodejs:16
1422
WORKDIR /app
1523

24+
ENV NODE_ENV=production
1625
COPY --from=builder /app/dist .
17-
COPY --from=builder /app/node_modules ./node_modules
26+
COPY --from=node_modules /app/node_modules ./node_modules
1827

1928
EXPOSE 3000
20-
CMD node ./index.js
29+
CMD ["./index.js"]

0 commit comments

Comments
 (0)