forked from commerceblock/mercury
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
110 lines (95 loc) · 3.07 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
FROM commerceblock/bitcoin:0.20.1 AS bitcoin
FROM rustlang/rust:nightly-stretch AS builder
ARG MERC_MS_TEST_SLOT
ARG MERC_MS_TEST_TOKEN
ARG MERC_DB_USER_W
ARG MERC_DB_PASS_W
ARG MERC_DB_HOST_W
ARG MERC_DB_PORT_W
ARG MERC_DB_DATABASE_W
ARG MERC_DB_USER_R
ARG MERC_DB_PASS_R
ARG MERC_DB_HOST_R
ARG MERC_DB_PORT_R
ARG MERC_DB_DATABASE_R
ENV MERC_MS_TEST_SLOT=$MERC_MS_TEST_SLOT \
MERC_MS_TEST_TOKEN=$MERC_MS_TEST_TOKEN \
MERC_DB_USER_W=$MERC_DB_USER_W \
MERC_DB_PASS_W=$MERC_DB_PASS_W \
MERC_DB_HOST_W=$MERC_DB_HOST_W \
MERC_DB_PORT_W=$MERC_DB_PORT_W \
MERC_DB_DATABASE_W=$MERC_DB_DATABASE_W \
MERC_DB_USER_R=$MERC_DB_USER_R \
MERC_DB_PASS_R=$MERC_DB_PASS_R \
MERC_DB_HOST_R=$MERC_DB_HOST_R \
MERC_DB_PORT_R=$MERC_DB_PORT_R \
MERC_DB_DATABASE_R=$MERC_DB_DATABASE_R
ENV BITCOIN_VERSION=0.20.1
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
COPY . /mercury
WORKDIR /mercury
RUN set -ex \
&& apt update \
&& apt install -y \
apt-utils \
lsb-core \
software-properties-common \
apt-transport-https \
ca-certificates \
&& wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 12 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=bitcoin /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-cli /usr/local/bin/
COPY --from=bitcoin /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoind /usr/local/bin/
COPY --from=bitcoin /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-tx /usr/local/bin/
COPY --from=bitcoin /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-wallet /usr/local/bin/
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
RUN set -ex \
&& bitcoind \
-printtoconsole \
-rpcuser=mercury \
-rpcpassword=mercury \
-rpcallowip=0.0.0.0/0 \
-rpcport=8332 \
-server=1 \
-txindex=1 \
-prune=0 \
-regtest=1 \
-daemon=1 \
&& echo "Warming up" && sleep 3 \
&& bitcoin-cli \
-rpcuser=mercury \
-rpcpassword=mercury \
-rpcconnect=0.0.0.0 \
-rpcport=8332 \
getblockchaininfo
RUN set -ex \
&& cd server \
&& cargo test -j 4 -- --test-threads=4 \
&& cargo build --release
ENV MERC_MS_TEST_SLOT=
ENV MERC_MS_TEST_TOKEN=
ENV MERC_DB_USER_W=
ENV MERC_DB_PASS_W=
ENV MERC_DB_HOST_W=
ENV MERC_DB_PORT_W=
ENV MERC_DB_DATABASE_W=
ENV MERC_DB_USER_R=
ENV MERC_DB_PASS_R=
ENV MERC_DB_HOST_R=
ENV MERC_DB_PORT_R=
ENV MERC_DB_DATABASE_R=
FROM debian:buster
COPY --from=builder /mercury/target/release/server_exec /usr/local/bin/mercury
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN set -ex \
&& apt update \
&& apt install -y apt-utils libssl-dev apt-transport-https ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/docker-entrypoint.sh"]