This repository was archived by the owner on May 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (58 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
88 lines (58 loc) · 1.24 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
FROM node:12.16.1-alpine AS node
ENV NODE_OPTIONS --unhandled-rejections=strict
WORKDIR /app
#
# Stage: Production NPM install
#
FROM node AS npm-prod
COPY package.json \
package-lock.json \
./
RUN npm install --production
#
# Stage: Development NPM install
#
FROM npm-prod AS npm-dev
RUN npm install
#
# Stage: Base environment
#
FROM node AS base
EXPOSE 8080
COPY LICENSE.md .
HEALTHCHECK --interval=5s --timeout=1s \
CMD wget --quiet --tries=1 --spider http://localhost:8080/ || exit 1
#
# Stage: Development environment
#
FROM base AS dev
ENV NODE_ENV=development
COPY .eslintignore \
.eslintrc.js \
jest.config.js \
stryker.conf.json \
tsconfig.json \
tsconfig.lint.json \
./
COPY --from=npm-dev /app/ .
COPY test/ test/
COPY src/ src/
CMD ["npm", "run", "start:dev"]
#
# Stage: Production build
#
FROM dev AS build-prod
ENV NODE_ENV=production
RUN npm run build
#
# Stage: Production environment
#
FROM base AS prod
ARG image_tag
ENV NODE_ENV=production
COPY --from=npm-prod /app/ .
COPY --from=build-prod /app/build/ build/
USER node
LABEL org.opencontainers.image.revision=${image_tag} \
org.opencontainers.image.source=https://github.com/libero/article-page
CMD ["npm", "run", "start"]