forked from BitGo/BitGoJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
198 lines (188 loc) · 9.55 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# An elaborated scheme to build all the dependencies of all packages first in a cached layer
# https://stackoverflow.com/a/63142468/134409
# https://medium.com/@emilefugulin/building-a-sane-docker-image-for-typescript-lerna-and-prisma-2-76d8ff9926e4
FROM node:16-alpine@sha256:72a490e7ed8aed68e16b8dc8f37b5bcc35c5b5c56ee3256effcdee63e2546f93 AS filter-packages-json
MAINTAINER Tyler Levine <[email protected]>
COPY package.json yarn.lock lerna.json ./
WORKDIR /tmp/bitgo
COPY package.json yarn.lock lerna.json ./
COPY modules ./modules
# delete all the non package.json files under `./modules/`
RUN find modules \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
FROM node:16-alpine@sha256:72a490e7ed8aed68e16b8dc8f37b5bcc35c5b5c56ee3256effcdee63e2546f93 AS builder
RUN apk add --no-cache git python3 make g++ libtool autoconf automake
WORKDIR /tmp/bitgo
COPY --from=filter-packages-json /tmp/bitgo .
# (skip postinstall) https://github.com/yarnpkg/yarn/issues/4100#issuecomment-388944260
RUN NOYARNPOSTINSTALL=1 yarn install --pure-lockfile
COPY . .
RUN \
# clean up unnecessary local node_modules and dist
rm -rf modules/**/node_modules modules/**/dist && \
# install with dev deps so we can run the prepare script
yarn install --frozen-lockfile && \
# install again to prune dev deps
yarn install --production --frozen-lockfile --non-interactive --ignore-scripts && \
# remove any src code leftover (we only want dist)
rm -r modules/*/src
FROM node:16-alpine@sha256:72a490e7ed8aed68e16b8dc8f37b5bcc35c5b5c56ee3256effcdee63e2546f93
RUN apk add --no-cache tini
# copy the root node_modules to the bitgo-express parent node_modules
COPY --from=builder /tmp/bitgo/node_modules /var/node_modules/
COPY --from=builder /tmp/bitgo/modules/express /var/bitgo-express/
#COPY_START
COPY --from=builder /tmp/bitgo/modules/sdk-core /var/modules/sdk-core/
RUN cd /var/modules/sdk-core && yarn link
COPY --from=builder /tmp/bitgo/modules/bls-dkg /var/modules/bls-dkg/
RUN cd /var/modules/bls-dkg && yarn link
COPY --from=builder /tmp/bitgo/modules/statics /var/modules/statics/
RUN cd /var/modules/statics && yarn link
COPY --from=builder /tmp/bitgo/modules/utxo-lib /var/modules/utxo-lib/
RUN cd /var/modules/utxo-lib && yarn link
COPY --from=builder /tmp/bitgo/modules/blake2b /var/modules/blake2b/
RUN cd /var/modules/blake2b && yarn link
COPY --from=builder /tmp/bitgo/modules/blake2b-wasm /var/modules/blake2b-wasm/
RUN cd /var/modules/blake2b-wasm && yarn link
COPY --from=builder /tmp/bitgo/modules/bitgo /var/modules/bitgo/
RUN cd /var/modules/bitgo && yarn link
COPY --from=builder /tmp/bitgo/modules/abstract-utxo /var/modules/abstract-utxo/
RUN cd /var/modules/abstract-utxo && yarn link
COPY --from=builder /tmp/bitgo/modules/blockapis /var/modules/blockapis/
RUN cd /var/modules/blockapis && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-api /var/modules/sdk-api/
RUN cd /var/modules/sdk-api && yarn link
COPY --from=builder /tmp/bitgo/modules/sjcl /var/modules/sjcl/
RUN cd /var/modules/sjcl && yarn link
COPY --from=builder /tmp/bitgo/modules/unspents /var/modules/unspents/
RUN cd /var/modules/unspents && yarn link
COPY --from=builder /tmp/bitgo/modules/account-lib /var/modules/account-lib/
RUN cd /var/modules/account-lib && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-algo /var/modules/sdk-coin-algo/
RUN cd /var/modules/sdk-coin-algo && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-avaxc /var/modules/sdk-coin-avaxc/
RUN cd /var/modules/sdk-coin-avaxc && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-eth /var/modules/sdk-coin-eth/
RUN cd /var/modules/sdk-coin-eth && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-avaxp /var/modules/sdk-coin-avaxp/
RUN cd /var/modules/sdk-coin-avaxp && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bsc /var/modules/sdk-coin-bsc/
RUN cd /var/modules/sdk-coin-bsc && yarn link
COPY --from=builder /tmp/bitgo/modules/abstract-eth /var/modules/abstract-eth/
RUN cd /var/modules/abstract-eth && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-celo /var/modules/sdk-coin-celo/
RUN cd /var/modules/sdk-coin-celo && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-cspr /var/modules/sdk-coin-cspr/
RUN cd /var/modules/sdk-coin-cspr && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-dot /var/modules/sdk-coin-dot/
RUN cd /var/modules/sdk-coin-dot && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-etc /var/modules/sdk-coin-etc/
RUN cd /var/modules/sdk-coin-etc && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-eth2 /var/modules/sdk-coin-eth2/
RUN cd /var/modules/sdk-coin-eth2 && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-hbar /var/modules/sdk-coin-hbar/
RUN cd /var/modules/sdk-coin-hbar && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-near /var/modules/sdk-coin-near/
RUN cd /var/modules/sdk-coin-near && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-polygon /var/modules/sdk-coin-polygon/
RUN cd /var/modules/sdk-coin-polygon && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-rbtc /var/modules/sdk-coin-rbtc/
RUN cd /var/modules/sdk-coin-rbtc && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-sol /var/modules/sdk-coin-sol/
RUN cd /var/modules/sdk-coin-sol && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-stx /var/modules/sdk-coin-stx/
RUN cd /var/modules/sdk-coin-stx && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-trx /var/modules/sdk-coin-trx/
RUN cd /var/modules/sdk-coin-trx && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-xtz /var/modules/sdk-coin-xtz/
RUN cd /var/modules/sdk-coin-xtz && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-aca /var/modules/sdk-coin-aca/
RUN cd /var/modules/sdk-coin-aca && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-ada /var/modules/sdk-coin-ada/
RUN cd /var/modules/sdk-coin-ada && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bch /var/modules/sdk-coin-bch/
RUN cd /var/modules/sdk-coin-bch && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bcha /var/modules/sdk-coin-bcha/
RUN cd /var/modules/sdk-coin-bcha && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bsv /var/modules/sdk-coin-bsv/
RUN cd /var/modules/sdk-coin-bsv && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-btc /var/modules/sdk-coin-btc/
RUN cd /var/modules/sdk-coin-btc && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-btg /var/modules/sdk-coin-btg/
RUN cd /var/modules/sdk-coin-btg && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-dash /var/modules/sdk-coin-dash/
RUN cd /var/modules/sdk-coin-dash && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-doge /var/modules/sdk-coin-doge/
RUN cd /var/modules/sdk-coin-doge && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-eos /var/modules/sdk-coin-eos/
RUN cd /var/modules/sdk-coin-eos && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-ethw /var/modules/sdk-coin-ethw/
RUN cd /var/modules/sdk-coin-ethw && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-ltc /var/modules/sdk-coin-ltc/
RUN cd /var/modules/sdk-coin-ltc && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-xlm /var/modules/sdk-coin-xlm/
RUN cd /var/modules/sdk-coin-xlm && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-xrp /var/modules/sdk-coin-xrp/
RUN cd /var/modules/sdk-coin-xrp && yarn link
COPY --from=builder /tmp/bitgo/modules/sdk-coin-zec /var/modules/sdk-coin-zec/
RUN cd /var/modules/sdk-coin-zec && yarn link
#COPY_END
#LINK_START
RUN cd /var/bitgo-express && \
yarn link @bitgo/sdk-core && \
yarn link @bitgo/bls-dkg && \
yarn link @bitgo/statics && \
yarn link @bitgo/utxo-lib && \
yarn link @bitgo/blake2b && \
yarn link @bitgo/blake2b-wasm && \
yarn link bitgo && \
yarn link @bitgo/abstract-utxo && \
yarn link @bitgo/blockapis && \
yarn link @bitgo/sdk-api && \
yarn link @bitgo/sjcl && \
yarn link @bitgo/unspents && \
yarn link @bitgo/account-lib && \
yarn link @bitgo/sdk-coin-algo && \
yarn link @bitgo/sdk-coin-avaxc && \
yarn link @bitgo/sdk-coin-eth && \
yarn link @bitgo/sdk-coin-avaxp && \
yarn link @bitgo/sdk-coin-bsc && \
yarn link @bitgo/abstract-eth && \
yarn link @bitgo/sdk-coin-celo && \
yarn link @bitgo/sdk-coin-cspr && \
yarn link @bitgo/sdk-coin-dot && \
yarn link @bitgo/sdk-coin-etc && \
yarn link @bitgo/sdk-coin-eth2 && \
yarn link @bitgo/sdk-coin-hbar && \
yarn link @bitgo/sdk-coin-near && \
yarn link @bitgo/sdk-coin-polygon && \
yarn link @bitgo/sdk-coin-rbtc && \
yarn link @bitgo/sdk-coin-sol && \
yarn link @bitgo/sdk-coin-stx && \
yarn link @bitgo/sdk-coin-trx && \
yarn link @bitgo/sdk-coin-xtz && \
yarn link @bitgo/sdk-coin-aca && \
yarn link @bitgo/sdk-coin-ada && \
yarn link @bitgo/sdk-coin-bch && \
yarn link @bitgo/sdk-coin-bcha && \
yarn link @bitgo/sdk-coin-bsv && \
yarn link @bitgo/sdk-coin-btc && \
yarn link @bitgo/sdk-coin-btg && \
yarn link @bitgo/sdk-coin-dash && \
yarn link @bitgo/sdk-coin-doge && \
yarn link @bitgo/sdk-coin-eos && \
yarn link @bitgo/sdk-coin-ethw && \
yarn link @bitgo/sdk-coin-ltc && \
yarn link @bitgo/sdk-coin-xlm && \
yarn link @bitgo/sdk-coin-xrp && \
yarn link @bitgo/sdk-coin-zec
#LINK_END
#LABEL_START
LABEL created="Thu, 18 Aug 2022 14:16:35 GMT"
LABEL version=9.12.4
LABEL git_hash=5bca14b1f7a7c691393db3c4981ad05d731b3c00
#LABEL_END
USER node
ENV NODE_ENV production
ENV BITGO_BIND 0.0.0.0
EXPOSE 3080
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/node", "/var/bitgo-express/bin/bitgo-express"]