forked from keep-network/tbtc-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (36 loc) · 1.21 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
FROM node:14-alpine as builder
# Add packages necessary to perform the build process.
RUN apk add --update --no-cache \
git \
bash \
build-base \
python3 \
&& \
rm -rf /var/cache/apk/ && mkdir /var/cache/apk/ && \
rm -rf /usr/share/man
# Install node-prune (https://github.com/tj/node-prune)
RUN wget https://gobinaries.com/tj/node-prune
RUN sh node-prune
# Use `https://` instead of unauthenticated `git://` protocol.
RUN git config --global url."https://".insteadOf git://
WORKDIR /monitoring-build
# Copy only essential files.
COPY package.json yarn.lock ./
COPY tsconfig.json ./
COPY src ./src
RUN yarn install --frozen-lockfile --ignore-scripts
RUN yarn run postinstall
RUN yarn build
# Prune development dependencies.
RUN rm -rf ./node_modules
RUN rm -rf ./external
RUN yarn install --production --frozen-lockfile --ignore-scripts
RUN yarn run postinstall
# Prune other unnecessary files from dependencies using node-prune.
RUN node-prune
FROM node:14-alpine as runner
WORKDIR /monitoring
COPY --from=builder /monitoring-build/package.json ./package.json
COPY --from=builder /monitoring-build/dist ./dist
COPY --from=builder /monitoring-build/node_modules ./node_modules
ENTRYPOINT ["node", "."]