-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (24 loc) · 817 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
# Builder stage.
# This state compile our TypeScript to get the JavaScript code
FROM node:12.13.0 AS dev
WORKDIR /usr/src/app
COPY package*.json ./
COPY tsconfig*.json ./
COPY ./src ./src
EXPOSE 8080
# ci stands for clean install
# it removes node_modules/ and looks in package-lock.json
# for strict versioning
RUN npm ci --quiet && npm run build
# Production stage.
# This state compile get back the JavaScript code from builder stage
# It will also install the production package only
# we use alpine flavour because it's lightweight
FROM node:12.13.0-alpine AS prod
WORKDIR /app
# now npm install will not install devDependencies
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --quiet --only=production
## We just need the build to execute the command
COPY --from=dev /usr/src/app/build ./build