-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
36 lines (24 loc) · 825 Bytes
/
Dockerfile.dev
File metadata and controls
36 lines (24 loc) · 825 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
# the first image use node image as the builder because it has git program
FROM node:14.15 as builder
WORKDIR /app
COPY ./package*.json ./
COPY ./tsconfig.json ./
## install dependencies
RUN npm install
COPY . .
## compile typescript
RUN npm run build
## remove packages of devDependencies
RUN npm prune --production
# ===================================================
# the second image use node:slim image as the runtime
FROM node:slim as runtime
WORKDIR /app
ENV NODE_ENV="development"
## Copy the necessary files form builder
COPY --from=builder "/app/dist/" "/app/dist/"
COPY --from=builder "/app/.env.development" "/app/.env.development"
COPY --from=builder "/app/node_modules/" "/app/node_modules/"
COPY --from=builder "/app/package.json" "/app/package.json"
EXPOSE 8080
CMD ["npm", "run", "start:prod"]