Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
paths:
- '27.2/**'
- '28.1/**'
- '28.2/**'
- '29.0/**'
- '29.1rc2/**'
- '30.0rc1/**'
Expand All @@ -16,8 +16,8 @@ jobs:
strategy:
matrix:
version:
- '30.0rc1/alpine'
- '30.0rc1'
- '28.2/alpine'
- '28.2'
fail-fast: true
steps:
- name: Checkout
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:

- name: Login into Docker Hub
uses: docker/login-action@v3
if: ${{ steps.prepare.outputs.push }} == "true"
if: ${{ steps.prepare.outputs.push == 'true' }}
with:
username: ${{ steps.prepare.outputs.docker_username }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
Expand Down
69 changes: 69 additions & 0 deletions 28.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM debian:bookworm-slim as builder

LABEL maintainer.0="Will Clark (@willcl-ark)"

RUN apt-get update -y \
&& apt-get install -y ca-certificates curl git gnupg gosu python3 wget --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG TARGETPLATFORM
ENV BITCOIN_VERSION=28.2
ENV SIGS_REPO_URL="https://github.com/bitcoin-core/guix.sigs.git"
ENV SIGS_CLONE_DIR="guix.sigs"
ENV TMPDIR="/tmp/bitcoin_verify_binaries"

COPY verify-${BITCOIN_VERSION}.py .

RUN set -ex \
&& if echo $BITCOIN_VERSION | grep -q "rc" ; then \
VERIFY_VERSION=$(echo $BITCOIN_VERSION | sed 's/\(.*\)rc\([0-9]*\)/\1-rc\2/'); \
else \
VERIFY_VERSION=$BITCOIN_VERSION; \
fi \
&& echo "$VERIFY_VERSION" \
&& 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 \
&& git clone ${SIGS_REPO_URL} ${SIGS_CLONE_DIR} \
&& gpg --import "${SIGS_CLONE_DIR}"/builder-keys/* \
&& ./verify-${BITCOIN_VERSION}.py \
--min-good-sigs 6 pub "${VERIFY_VERSION}-linux" \
&& tar -xzf "${TMPDIR}.${VERIFY_VERSION}-linux/bitcoin-${BITCOIN_VERSION}-${TARGETPLATFORM}.tar.gz" -C /opt \
&& rm -rf ${SIGS_CLONE_DIR} \
&& rm -rf ${TMPDIR} \
&& rm -rf /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-qt

# Second stage
FROM debian:bookworm-slim

ARG UID=101
ARG GID=101

ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=28.2
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH

RUN groupadd --gid ${GID} bitcoin \
&& if echo "$BITCOIN_VERSION" | grep -q "rc"; then \
PADDED_VERSION=$(echo $BITCOIN_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)rc/\1.\2.0rc/'); \
else \
PADDED_VERSION=$BITCOIN_VERSION; \
fi \
&& echo "Padded version: $PADDED_VERSION" \
&& useradd --create-home --no-log-init -u ${UID} -g ${GID} bitcoin \
&& apt-get update -y \
&& apt-get install -y gosu --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=builder /opt/bitcoin-${BITCOIN_VERSION} /opt/bitcoin-${BITCOIN_VERSION}

COPY docker-entrypoint.sh /entrypoint.sh

VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18443 18444 38333 38332

ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "Bitcoin Core version v${PADDED_VERSION}"
CMD ["bitcoind"]
109 changes: 109 additions & 0 deletions 28.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core

RUN apk --no-cache add \
autoconf \
automake \
boost-dev \
build-base \
chrpath \
file \
gnupg \
git \
libevent-dev \
libtool \
linux-headers \
sqlite-dev \
zeromq-dev

ENV BITCOIN_VERSION=28.2
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ENV BITCOIN_SOURCE_DIR=/bitcoin/src
ENV SIGS_REPO_URL="https://github.com/bitcoin-core/guix.sigs.git"
ENV SIGS_CLONE_DIR="guix.sigs"
ENV VERIFY_SCRIPT_URL="https://raw.githubusercontent.com/bitcoin/bitcoin/v${BITCOIN_VERSION}/contrib/verify-binaries/verify.py"

WORKDIR /bitcoin
COPY verify-${BITCOIN_VERSION}.py .

RUN set -ex \
&& if echo $BITCOIN_VERSION | grep -q "rc" ; then \
VERIFY_VERSION=$(echo $BITCOIN_VERSION | sed 's/\(.*\)rc\([0-9]*\)/\1-rc\2/'); \
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION%%rc*}/test.rc${BITCOIN_VERSION##*rc}"; \
else \
VERIFY_VERSION=$BITCOIN_VERSION; \
ADDRESS="https://bitcoincore.org/bin/bitcoin-core-${VERIFY_VERSION}"; \
fi \
&& echo "$VERIFY_VERSION" \
&& wget ${ADDRESS}/bitcoin-${BITCOIN_VERSION}.tar.gz \
&& wget ${ADDRESS}/SHA256SUMS \
&& wget ${ADDRESS}/SHA256SUMS.asc \
&& git clone ${SIGS_REPO_URL} ${SIGS_CLONE_DIR} \
&& gpg --import "${SIGS_CLONE_DIR}"/builder-keys/* \
&& ./verify-${BITCOIN_VERSION}.py bin SHA256SUMS \
"bitcoin-${BITCOIN_VERSION}.tar.gz" \
&& mkdir -p ${BITCOIN_SOURCE_DIR} \
&& tar -xzf "bitcoin-${BITCOIN_VERSION}.tar.gz" -C ${BITCOIN_SOURCE_DIR} \
&& rm -rf ${SIGS_CLONE_DIR}

WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}"

RUN ./autogen.sh
RUN ./configure \
--prefix=${BITCOIN_PREFIX} \
--mandir=/usr/share/man \
--disable-tests \
--disable-bench \
--disable-fuzz-binary \
--disable-ccache \
--with-gui=no \
--with-utils \
--without-libs \
--with-sqlite=yes \
--with-daemon
RUN make -j`nproc` -C src bitcoind bitcoin-cli bitcoin-tx
RUN make -j`nproc` install
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind

# Build stage for compiled artifacts
FROM alpine

ARG UID=100
ARG GID=101

LABEL maintainer.0="Will Clark (@willcl-ark)"

RUN addgroup bitcoin --gid ${GID} --system
RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin
RUN apk --no-cache add \
libevent \
libzmq \
shadow \
sqlite-libs \
su-exec

ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=28.2
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ENV PATH=${BITCOIN_PREFIX}/bin:$PATH

COPY --from=bitcoin-core /opt /opt
COPY docker-entrypoint.sh /entrypoint.sh

RUN if echo "$BITCOIN_VERSION" | grep -q "rc"; then \
PADDED_VERSION=$(echo $BITCOIN_VERSION | sed 's/\([0-9]\+\)\.\([0-9]\+\)rc/\1.\2.0rc/'); \
else \
PADDED_VERSION=$BITCOIN_VERSION; \
fi

VOLUME ["/home/bitcoin/.bitcoin"]

EXPOSE 8332 8333 18332 18333 18444

ENTRYPOINT ["/entrypoint.sh"]

RUN bitcoind -version | grep "Bitcoin Core version v${PADDED_VERSION}"

CMD ["bitcoind"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
- `29.0`, `29`, `latest` ([29.0/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.0/Dockerfile)) [**multi-platform**]
- `29.0-alpine`, `29-alpine` ([29.0/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/29.0/alpine/Dockerfile))

- `28.1`, `28` ([28.1/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.1/Dockerfile)) [**multi-platform**]
- `28.1-alpine`, `28-alpine`, `alpine` ([28.1/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.1/alpine/Dockerfile))
- `28.2`, `28` ([28.2/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.2/Dockerfile)) [**multi-platform**]
- `28.2-alpine`, `28-alpine`, `alpine` ([28.2/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/28.2/alpine/Dockerfile))

- `27.2`, `27` ([27.2/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/27.2/Dockerfile)) [**multi-platform**]
- `27.2-alpine`, `27-alpine` ([27.2/alpine/Dockerfile](https://github.com/willcl-ark/bitcoin-core-docker/blob/master/27.2/alpine/Dockerfile))
Expand Down
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions deprecated/28.1/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
set -e

if [ -n "${UID+x}" ] && [ "${UID}" != "0" ]; then
usermod -u "$UID" bitcoin
fi

if [ -n "${GID+x}" ] && [ "${GID}" != "0" ]; then
groupmod -g "$GID" bitcoin
fi

echo "$0: assuming uid:gid for bitcoin:bitcoin of $(id -u bitcoin):$(id -g bitcoin)"

if [ "$(echo "$1" | cut -c1)" = "-" ]; then
echo "$0: assuming arguments for bitcoind"

set -- bitcoind "$@"
fi

if [ "$(echo "$1" | cut -c1)" = "-" ] || [ "$1" = "bitcoind" ]; then
mkdir -p "$BITCOIN_DATA"
chmod 700 "$BITCOIN_DATA"
# Fix permissions for home dir.
chown -R bitcoin:bitcoin "$(getent passwd bitcoin | cut -d: -f6)"
# Fix permissions for bitcoin data dir.
chown -R bitcoin:bitcoin "$BITCOIN_DATA"

echo "$0: setting data directory to $BITCOIN_DATA"

set -- "$@" -datadir="$BITCOIN_DATA"
fi

if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
echo
exec su-exec bitcoin "$@"
fi

echo
exec "$@"
Loading