Merge pull request #96 from ruimarinho/feature/version-0-20

Add bitcoin-core@0.20.0
This commit is contained in:
Rui Marinho 2020-06-07 21:18:31 +01:00 committed by GitHub
commit 8845d5ba5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 361 additions and 11 deletions

127
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,127 @@
name: build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
version:
- '0.20'
- '0.20/alpine'
- '0.19'
- '0.19/alpine'
- '0.18'
- '0.18/alpine'
- '0.17'
- '0.17/alpine'
- '0.16'
- '0.16/alpine'
- '0.13'
- '0.13/alpine'
- '0.12'
- '0.12/alpine'
- '0.11'
- '0.11/alpine'
steps:
- name: Prepare Docker build
id: prepare
run: |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
REPO=ruimarinho/bitcoin-core
BITCOIN_VERSION=${{matrix.version}}
LATEST_BITCOIN_MAJOR_VERSION=$(ls | grep 0 | sort -n | tail -n 1)
TAGS=()
PUSH=false
PLATFORMS="linux/amd64"
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
if [[ ${BITCOIN_VERSION} == *"alpine"* ]]; then
TAGS+=("$REPO:$TAG-alpine")
else
TAGS+=("$REPO:$TAG")
fi
else
TAGS+=("$REPO:${BITCOIN_VERSION/\//-}")
fi
if [[ ${BITCOIN_VERSION} != *"alpine"* ]] && [ $(version ${BITCOIN_VERSION}) -ge $(version "0.19") ]; then
PLATFORMS="linux/amd64,linux/arm/v7,linux/arm64"
fi
if [ ${GITHUB_REF} == "refs/heads/master" ]; then
PUSH=true
if [ $(version ${BITCOIN_VERSION}) -ge $(version $LATEST_BITCOIN_MAJOR_VERSION) ] && [[ ${BITCOIN_VERSION} != *"alpine"* ]]; then
TAGS+=("$REPO:latest")
fi
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=docker_platforms::${PLATFORMS}
echo ::set-output name=docker_username::ruimarinho
echo ::set-output name=push::${PUSH}
echo ::set-output name=tags::${TAGS[@]}
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
- name: Checkout
uses: actions/checkout@v2
- name: Login into Docker Hub
env:
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
echo "${DOCKER_HUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
- name: Build Docker image
run: |
TAGS=(${{ steps.prepare.outputs.tags }})
echo "Build date: ${{ steps.prepare.outputs.build_date }}"
echo "Docker platform: ${{ steps.prepare.outputs.docker_platforms }}"
echo "Push: ${{ steps.prepare.outputs.push }}"
echo "Tags: ${{ steps.prepare.outputs.tags }}"
echo "Tags Arr: ${TAGS[@]}"
echo docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=${{steps.prepare.outputs.push}}" \
--progress=plain \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
$(printf "%s" "${TAGS[@]/#/ --tag }" ) \
${{ matrix.version }}/
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=${{steps.prepare.outputs.push}}" \
--progress=plain \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
$(printf "%s" "${TAGS[@]/#/ --tag }" ) \
${{ matrix.version }}/
- name: Check Docker image manifest
run: |
PUSH=${{ steps.prepare.outputs.push }}
if [ "${PUSH}" = false ]; then
echo "Image has not been pushed, skipping..."
exit 0
fi
TAGS=(${{ steps.prepare.outputs.tags }})
for TAG in "${TAGS[@]}"; do
echo "Inspecting ${TAG}"
docker buildx imagetools inspect "${TAG}"
done
- name: Clear Docker credentials
run: |
rm -f ${HOME}/.docker/config.json

View File

@ -1,5 +1,5 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
FROM alpine:3.9 as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.9 as bitcoin-core
COPY --from=berkeleydb /opt /opt

View File

@ -1,5 +1,5 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
FROM alpine:3.9 as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.9 as bitcoin-core
COPY --from=berkeleydb /opt /opt

View File

@ -1,5 +1,5 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
FROM alpine:3.9 as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.9 as bitcoin-core
COPY --from=berkeleydb /opt /opt

View File

@ -1,5 +1,5 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
FROM alpine:3.9 as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.9 as bitcoin-core
COPY --from=berkeleydb /opt /opt

View File

@ -1,5 +1,5 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
FROM alpine:3.9 as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
@ -23,7 +23,7 @@ RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
FROM alpine:3.9 as bitcoin-core
COPY --from=berkeleydb /opt /opt

47
0.20/Dockerfile Normal file
View File

@ -0,0 +1,47 @@
FROM debian:bullseye-slim
LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \
maintainer.1="Pedro Branco (@pedrobranco)" \
maintainer.2="Rui Marinho (@ruimarinho)"
RUN useradd -r bitcoin \
&& apt-get update -y \
&& apt-get install -y curl gnupg gosu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG TARGETPLATFORM
ENV BITCOIN_VERSION=0.20.0
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV PATH=/opt/bitcoin-${BITCOIN_VERSION}/bin:$PATH
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 \
&& for key in \
01EA5486DE18A882D4C2684590C8019E36C2E964 \
; do \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \
done \
&& curl -SLO https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${TARGETPLATFORM}.tar.gz \
&& curl -SLO https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc \
&& gpg --verify SHA256SUMS.asc \
&& grep " bitcoin-${BITCOIN_VERSION}-${TARGETPLATFORM}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \
&& tar -xzf *.tar.gz -C /opt \
&& rm *.tar.gz *.asc \
&& rm -rf /opt/bitcoin-${BITCOIN_VERSION}/bin/bitcoin-qt
COPY docker-entrypoint.sh /entrypoint.sh
VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18443 18444
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bitcoind"]

121
0.20/alpine/Dockerfile Normal file
View File

@ -0,0 +1,121 @@
# Build stage for BerkeleyDB
FROM alpine as berkeleydb
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
RUN apk --no-cache add automake
RUN apk --no-cache add build-base
RUN apk --no-cache add libressl
ENV BERKELEYDB_VERSION=db-4.8.30.NC
ENV BERKELEYDB_PREFIX=/opt/${BERKELEYDB_VERSION}
RUN wget https://download.oracle.com/berkeley-db/${BERKELEYDB_VERSION}.tar.gz
RUN tar -xzf *.tar.gz
RUN sed s/__atomic_compare_exchange/__atomic_compare_exchange_db/g -i ${BERKELEYDB_VERSION}/dbinc/atomic.h
RUN mkdir -p ${BERKELEYDB_PREFIX}
WORKDIR /${BERKELEYDB_VERSION}/build_unix
RUN ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${BERKELEYDB_PREFIX}
RUN make -j4
RUN make install
RUN rm -rf ${BERKELEYDB_PREFIX}/docs
# Build stage for Bitcoin Core
FROM alpine as bitcoin-core
COPY --from=berkeleydb /opt /opt
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
RUN apk --no-cache add automake
RUN apk --no-cache add boost-dev
RUN apk --no-cache add build-base
RUN apk --no-cache add chrpath
RUN apk --no-cache add file
RUN apk --no-cache add gnupg
RUN apk --no-cache add libevent-dev
RUN apk --no-cache add libressl
RUN apk --no-cache add libressl-dev
RUN apk --no-cache add libtool
RUN apk --no-cache add linux-headers
RUN apk --no-cache add zeromq-dev
RUN set -ex \
&& for key in \
90C8019E36C2E964 \
; do \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \
done
ENV BITCOIN_VERSION=0.20.0
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc
RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz
RUN gpg --verify SHA256SUMS.asc
RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c -
RUN tar -xzf *.tar.gz
WORKDIR /bitcoin-${BITCOIN_VERSION}
RUN sed -i '/AC_PREREQ/a\AR_FLAGS=cr' src/univalue/configure.ac
RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac
RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat.h
RUN ./autogen.sh
RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \
--prefix=${BITCOIN_PREFIX} \
--mandir=/usr/share/man \
--disable-tests \
--disable-bench \
--disable-ccache \
--with-gui=no \
--with-utils \
--with-libs \
--with-daemon
RUN make -j4
RUN make install
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0
# Build stage for compiled artifacts
FROM alpine
LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \
maintainer.1="Pedro Branco (@pedrobranco)" \
maintainer.2="Rui Marinho (@ruimarinho)"
RUN adduser -S bitcoin
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add \
boost-chrono \
boost-filesystem \
boost-system \
boost-thread \
libevent \
libressl \
libzmq \
su-exec
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV BITCOIN_VERSION=0.19.1
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
VOLUME ["/home/bitcoin/.bitcoin"]
EXPOSE 8332 8333 18332 18333 18444
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bitcoind"]

View File

@ -0,0 +1,26 @@
#!/bin/sh
set -e
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"
chown -R 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 "$@"

26
0.20/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
set -e
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"
chown -R 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 gosu bitcoin "$@"
fi
echo
exec "$@"

View File

@ -10,7 +10,10 @@ A bitcoin-core docker image with support for the following platforms:
## Tags
- `0.19.1`, `0.19`, `latest` ([0.19/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.19/Dockerfile)) [**multi-arch**]
- `0.20.0`, `0.20`, `latest` ([0.20/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.20/Dockerfile)) [**multi-arch**]
- `0.20.0-alpine`, `0.20-alpine` ([0.20/alpine/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.20/alpine/Dockerfile))
- `0.19.1`, `0.19` ([0.20/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.19/Dockerfile)) [**multi-arch**]
- `0.19.1-alpine`, `0.19-alpine` ([0.19/alpine/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.19/alpine/Dockerfile))
- `0.18.1`, `0.18`, ([0.18/Dockerfile](https://github.com/ruimarinho/docker-bitcoin-core/blob/master/0.18/Dockerfile))