forked from kylemanna/docker-bitcoind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
57 lines (46 loc) · 1.95 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
FROM ubuntu:bionic
MAINTAINER Kyle Manna <[email protected]>
ARG USER_ID
ARG GROUP_ID
ENV HOME /bitcoin
# add user with specified (or default) user/group ids
ENV USER_ID ${USER_ID:-1000}
ENV GROUP_ID ${GROUP_ID:-1000}
# you may pick VERSION(#L2) and SHASUM(#L45) from https://github.com/bitcoin-core/packaging/blob/master/snap/snapcraft.yaml
# check VERSION matches SHASUM
ENV VERSION 0.19.1
ENV SHASUM e91d9786cda5194e5aa0f1e064cc2c210698917773911207e56ea186ce188f93
ENV ARCH x86_64-linux-gnu
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -g ${GROUP_ID} bitcoin \
&& useradd -u ${USER_ID} -g bitcoin -s /bin/bash -m -d /bitcoin bitcoin
# grab gosu for easy step-down from root
RUN set -x && apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
wget \
gosu && \
cd /tmp && \
wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/SHA256SUMS.asc && \
wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/bitcoin-${VERSION}.tar.gz && \
wget https://bitcoincore.org/bin/bitcoin-core-${VERSION}/bitcoin-${VERSION}-${ARCH}.tar.gz && \
echo "$SHASUM SHA256SUMS.asc" | sha256sum --check && \
sha256sum --ignore-missing --check SHA256SUMS.asc && \
tar -xf bitcoin-${VERSION}-${ARCH}.tar.gz && \
tar -xf bitcoin-${VERSION}.tar.gz && \
echo "Running tests ..." && \
bitcoin-${VERSION}/bin/test_bitcoin && \
install -m 0755 -D -t /usr/local/bin bitcoin-${VERSION}/bin/bitcoind && \
install -m 0755 -D -t /usr/local/bin bitcoin-${VERSION}/bin/bitcoin-cli && \
cd / && \
apt-get purge -y \
ca-certificates \
wget && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD ./bin /usr/local/bin
VOLUME ["/bitcoin"]
EXPOSE 8332 8333 18332 18333
WORKDIR /bitcoin
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["btc_oneshot"]