Skip to content

Commit 564ca74

Browse files
committed
Refactor Dockerfile
1 parent 28c4784 commit 564ca74

1 file changed

Lines changed: 23 additions & 10 deletions

File tree

Dockerfile

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
FROM node:current
2-
3-
WORKDIR /app
4-
5-
COPY . .
6-
7-
RUN npm ci
8-
RUN npm run compile
9-
10-
ENTRYPOINT [ "node", "./out/cli/index.js" ]
1+
FROM node:14-alpine AS builder
2+
3+
WORKDIR /tmp
4+
5+
# Install node modules first to leverage Docker cache.
6+
COPY package*.json ./
7+
RUN npm ci
8+
9+
COPY tsconfig.json .
10+
COPY cli/ cli/
11+
COPY src/ src/
12+
RUN npm run compile
13+
14+
15+
FROM node:14-alpine
16+
17+
WORKDIR /app
18+
19+
COPY --from=builder /tmp/out .
20+
21+
USER node
22+
23+
ENTRYPOINT [ "node", "./cli/index.js" ]

0 commit comments

Comments
 (0)