-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (36 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
53 lines (36 loc) · 1.54 KB
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
FROM debian:bullseye-slim as builder
LABEL maintainer="Wesley Blake (@WesleyCharlesBlake)"
RUN useradd -r bitcoin \
&& apt-get update -y \
&& apt-get install -y curl gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# This should be ARG and created based on the host image builder platform.
ENV TARGETPLATFORM=linux/amd64
ENV BITCOIN_VERSION=0.21.0
RUN set -ex \
&& if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then export TARGETPLATFORM=x86_64-linux-gnu; fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then export TARGETPLATFORM=aarch64-linux-gnu; fi \
&& if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then export TARGETPLATFORM=arm-linux-gnueabihf; fi \
&& curl -SLO https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${TARGETPLATFORM}.tar.gz \
&& tar -xzf *.tar.gz -C /opt \
&& rm *.tar.gz \
&& rm -rf /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-qt
# Start a new, final image to reduce size.
FROM ubuntu:20.04 as final
RUN useradd -r bitcoin && \
apt-get update -y \
&& apt-get install -y curl gosu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=0.21.0
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH
VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18443 18444
COPY docker-entrypoint.sh /entrypoint.sh
COPY --from=builder /opt/ /opt/
RUN ls -al /opt/
ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}"
CMD ["bitcoind"]