forked from dashpay/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (49 loc) · 1.85 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
# syntax = docker/dockerfile:1.3
FROM node:16-alpine as builder
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
RUN apk update && \
apk --no-cache upgrade && \
apk add --no-cache git \
openssh-client \
linux-headers \
python3 \
alpine-sdk \
cmake \
zeromq-dev
# Enable corepack https://github.com/nodejs/corepack
RUN corepack enable
WORKDIR /platform
# Copy yarn files
COPY .yarn /platform/.yarn
COPY package.json yarn.lock .yarnrc.yml .pnp.* ./
# Copy only necessary packages from monorepo
COPY packages/js-drive packages/js-drive
COPY packages/dapi-grpc packages/dapi-grpc
COPY packages/feature-flags-contract packages/feature-flags-contract
COPY packages/js-dpp packages/js-dpp
COPY packages/js-grpc-common packages/js-grpc-common
COPY packages/masternode-reward-shares-contract packages/masternode-reward-shares-contract
COPY packages/dpns-contract packages/dpns-contract
COPY packages/dashpay-contract packages/dashpay-contract
# Print build output
RUN yarn config set enableInlineBuilds true
# Install Drive-specific dependencies using previous
# node_modules directory to reuse built binaries
RUN --mount=type=cache,target=/tmp/unplugged \
cp -R /tmp/unplugged /platform/.yarn/ && \
yarn workspaces focus --production @dashevo/drive && \
cp -R /platform/.yarn/unplugged /tmp/
FROM node:16-alpine
ARG NODE_ENV=production
ENV NODE_ENV ${NODE_ENV}
LABEL maintainer="Dash Developers <[email protected]>"
LABEL description="Drive Node.JS"
# Install ZMQ shared library
RUN apk update && apk add --no-cache zeromq-dev
# Install latest yarn
RUN yarn set version 3.1.0
WORKDIR /platform
COPY --from=builder /platform /platform
RUN cp /platform/packages/js-drive/.env.example /platform/packages/js-drive/.env
EXPOSE 26658