-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (33 loc) · 906 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
49
# --- Installing stage
FROM node:10.16.3-slim AS installer
WORKDIR /usr/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/app
COPY ./src src
COPY tsconfig.json .
COPY tslint.json .
COPY tsconfig.build.json .
COPY ./scripts scripts
RUN npm run build
RUN bash scripts/copySchemas.sh
# ---
# Running code under slim image (production part mostly)
FROM node:10.16.3-slim
## Clean new directory
WORKDIR /app
## Setup production ENV
## ARG NODE_ENV=production
## ENV NODE_ENV=${NODE_ENV}
## Copy package jsons from installer
COPY --from=installer /usr/app/package*.json ./
## Copy built files from builder
COPY --from=builder /usr/app/dist dist
## Install only production dependencies
RUN npm install --quiet
EXPOSE 3000
CMD [ "node", "dist/main.js" ]