forked from sciety/sciety
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
82 lines (58 loc) · 1.24 KB
/
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
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
FROM node:14.10.1-alpine3.12 AS node
ENV NODE_OPTIONS --unhandled-rejections=strict --enable-source-maps
WORKDIR /app
COPY .npmrc \
package.json \
package-lock.json \
./
#
# Stage: Development NPM install
#
FROM node AS npm-dev
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV TAIKO_SKIP_CHROMIUM_DOWNLOAD=true
RUN npm ci
#
# Stage: Development environment
#
FROM node AS dev
ENV NODE_ENV=development
ENV PRETTY_LOG=true
COPY .eslintignore \
.eslintrc.js \
.stylelintignore \
.stylelintrc \
jest.config.js \
tsconfig.json \
tsconfig.dev.json \
./
COPY --from=npm-dev /app/ .
COPY test/ test/
COPY src/ src/
COPY static/ static/
COPY scripts/ scripts/
COPY data/ data/
CMD ["npm", "run", "start:dev"]
#
# Stage: Production build
#
FROM dev AS build-prod
ENV NODE_ENV=production
RUN npm run build
#
# Stage: Production NPM install
#
FROM node AS npm-prod
RUN npm ci --production
#
# Stage: Production environment
#
FROM node AS prod
ENV NODE_ENV=production
COPY --from=npm-prod /app/ .
COPY --from=build-prod /app/build/ build/
COPY --from=build-prod /app/static/ static/
COPY data/ data/
HEALTHCHECK --interval=5s --timeout=1s \
CMD wget --quiet --tries=1 --spider http://localhost:80/ping || exit 1
CMD ["npm", "run", "start"]