-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (33 loc) · 882 Bytes
/
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
46
47
48
# --- Installing stage
FROM node:12.14.1 AS installer
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --quiet
# ---
# Building stage
FROM installer AS builder
## Workdir is shared between the stage so let's reuse it as we neeed the packages
WORKDIR /usr/src/app
COPY ./src src
COPY tsconfig.json .
COPY .eslintrc.js .
RUN npm run build
# ---
# Running code under slim image (production part mostly)
FROM node:12.14.1-slim
## Clean new directory
WORKDIR /app
## Setup production ENV
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
## Copy config files
COPY config ./config
COPY views ./views
## Copy package jsons from installer
COPY --from=installer /usr/src/app/package*.json ./
## Copy built files from builder
COPY --from=builder /usr/src/app/dist dist
## Install only production dependencies
RUN npm install --quiet
EXPOSE 5000
CMD [ "npm", "start" ]