This repository has been archived by the owner on Jan 1, 2021. It is now read-only.
forked from amacneil/docker-bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.erb
66 lines (53 loc) · 1.73 KB
/
Dockerfile.erb
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
FROM debian:stretch-slim
ENV CHAIN <%= chain %>
ENV VERSION <%= version %>
ENV URL <%= url %>
ENV SHA256 <%= sha256 %>
<% if asc_url -%>
ENV ASC_URL <%= asc_url %>
ENV PGP_KEY <%= key %>
ENV KEY_SERVER <%= key_server %>
<% end -%>
ENV PORT_P2P <%= p2p_port %>
ENV PORT_RPC <%= rpc_port %>
ENV PORT_P2PTESTNET <%= testnet_p2p_port %>
ENV PORT_RPCTESTNET <%= testnet_rpc_port %>
ENV DATA_FOLDER /data
<% case chain when "bitcoin", "litecoin" -%>
ENV DEFAULT_FOLDER "/home/$CHAIN/.$CHAIN"
ENV CONFIG "$CHAIN"
<% when "dcr" -%>
ENV DEFAULT_FOLDER "/home/$CHAIN/.dcrd"
ENV CONFIG "$CHAINd"
#<% end -%>
RUN groupadd -r "$CHAIN" && useradd -r -m -g "$CHAIN" "$CHAIN"
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu gpg wget \
&& rm -rf /var/lib/apt/lists/*
# install node binaries
RUN set -ex \
&& cd /tmp \
&& wget -qO "$CHAIN.tar.gz" "$URL" \
&& echo "$SHA256 $CHAIN.tar.gz" | sha256sum -c - \
<% if asc_url -%>
&& gpg --keyserver "$KEY_SERVER" --recv-keys "$PGP_KEY" \
&& wget -qO "$CHAIN.asc" "$ASC_URL" \
&& gpg --verify "$CHAIN.asc" \
<% end -%>
&& tar -xzvf "$CHAIN.tar.gz" -C /usr/local --strip-components=1 --exclude=*-qt --exclude=*.pak \
<% if chain == "dcr" -%>
&& cp /usr/local/resources/bin/* /usr/local/bin \
<% end -%>
&& rm -rf /tmp/*
# create data directory
RUN mkdir -p "$DATA_FOLDER" \
# && mkdir -p "$DEFAULT_FOLDER" \
&& chown -R "$CHAIN:$CHAIN" "$DATA_FOLDER" \
&& ln -sfn "$DATA_FOLDER" "$DEFAULT_FOLDER" \
&& chown -h "$CHAIN:$CHAIN" "$DEFAULT_FOLDER"
VOLUME "$DATA_FOLDER"
EXPOSE "$PORT_P2P" "$PORT_RPC" "$PORT_P2PTESTNET" "$PORT_RPCTESTNET"
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD "$CHAIN"d