From d1fbb8361d551e99c5a0fdb23126787f27884032 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Fri, 3 May 2019 01:30:22 +0700 Subject: [PATCH 01/30] experiment with 0.18 --- .travis.yml | 56 ++++++++++++++++++++++ 0.18/Dockerfile | 99 +++++++++++++++++++++++++++++++++++++++ travis/before-script.sh | 9 ++++ travis/docker-manifest.sh | 48 +++++++++++++++++++ travis/script.sh | 39 +++++++++++++++ 5 files changed, 251 insertions(+) create mode 100644 .travis.yml create mode 100644 0.18/Dockerfile create mode 100755 travis/before-script.sh create mode 100755 travis/docker-manifest.sh create mode 100755 travis/script.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9fb234d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,56 @@ +sudo: required + +dist: xenial + +services: + - docker + +language: minimal + +# SLUG - converts Gihub slug (`lncm/docker-bitcoind`) to Docker slug (`lncm/bitcoind`) +# VER - if TAG is being build, VER contains only MAJOR and MINOR parts of the version (ex. `0.18.0` -> `0.18`) +# DIR - if BRANCH is being built, use DIR with the highest version number +# PREFIX - sets Dockerfile prefix. Be it based on `git tag`, or highest-version DIR name +env: + global: + - SLUG="${TRAVIS_REPO_SLUG/docker-/}" + - VER=$(echo ${TRAVIS_TAG} | cut -d. -f1,2) + - DIR=$(ls -vd */ | grep '^[0-9]' | tail -n 1 | tr -d /) + - PREFIX="${VER:-$DIR}" + +stages: + - build + - name: deploy + if: tag IS present + +jobs: + include: + - stage: build + name: "Build Docker image from source for amd64" + env: ARCH=amd64 SOURCE=code + + - name: "Build Docker image from binary for amd64" + env: ARCH=amd64 SOURCE=binary + +# - name: "Build Docker image from binary for arm" +# env: ARCH=arm SOURCE=binary + + - stage: deploy + name: "Aggregate Docker images under one manifest" + script: ./travis/docker-manifest.sh + + - name: "Upload Docker containers to Github Releases" + deploy: + skip_cleanup: true + provider: releases + api_key: + secure: H7PazuFTFL/sTAf6DH47wB81rfB6AXsPdiDBTmMvPc6+P7zr3O+1g6T1c93sUq5wrVqUnD/XKLmPXDTWhiQVoLkdDPzM9fdd2JTzgbzfXTDtg7gi/mNuZOgftoKwRYiLhNnWR/hKmtLcXFYYzKVRt1BUGShv722y4lVl/GPolzRLGyO1+5f0dC48VBjYmDxInUkM32bFkVSlQ2ro+OndecRhn/Pd8oOPPOwwM+/4iplsbBe4pRJ4kHMjgxdJRnV3kb+jUuA0Q+4U5XXPDGLw4BDh6/wZZ4IUgIAubNam32B7lql9t733ksuPtWA40rkwEFmfQyGGU1QEzb4gHUOcKpKfm43s8THjU85EnSSuyv3NWmZL4/wtmnJL/SpW6azdnSjycJUlddXX1MvsMvdnrZrSSU4WWCHtxOxgm1Figv/QAtn48NMwhmpCya2HYBZKlpqqPYj0j3pk9+ifJANF9DzMJ/xBXuPBW7M3WFCDlnGIqXXRAKbk6mEkecBk8JH0Qn/gGVm+pTV9Rcm2wKcQwrSyBkC//nJ6CXQXZ9OSW8m7NqkCRfIjSQ9g/caZgkxNEKyNYWssLB8UJ8CKyrkRH0jjfXJ1bhwbyw3Opg6b6rafPqQHwGb9Dm8Z8QlnhyafVEcry9kRVax6NWMNZkCP19U0t0Fhs0OFR2Ex7FbZ+Cw= + file_glob: true + file: images/*.tgz + on: + repo: lncm/docker-bitcoind + tags: true + +before_script: ./travis/before-script.sh +script: ./travis/script.sh + diff --git a/0.18/Dockerfile b/0.18/Dockerfile new file mode 100644 index 0000000..e22fe71 --- /dev/null +++ b/0.18/Dockerfile @@ -0,0 +1,99 @@ +# Build stage for Bitcoin Core +FROM alpine:3.9 AS bitcoin-core + +# fetch already built berkeleydb +COPY --from=lncm/berkeleydb:db-4.8.30.NC /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 protobuf-dev +RUN apk --no-cache add zeromq-dev +RUN set -ex \ + && for key in \ + 90C8019E36C2E964 \ + ; do \ + gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ + gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done + +ENV BITCOIN_VERSION=0.18.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 +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:3.9 AS final + +LABEL maintainer.0="nolim1t (@nolim1t)" \ + maintainer.1="Damian Mee (@meeDamian)" + +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 \ + boost-program_options \ + libevent \ + libressl \ + libzmq \ + su-exec + +ENV BITCOIN_VERSION=0.18.0 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH + +VOLUME /root/.bitcoin + +COPY --from=bitcoin-core /opt /opt + +# Ports: +# 8080 - +# 8332 - RPC main net +# 8333 - P2P network main net +# 18332 - RPC test net +# 18443 - RPC reg net + +EXPOSE 8080 8332 8333 18332 18333 18444 28333 28332 + +ENTRYPOINT ["bitcoind"] +CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/travis/before-script.sh b/travis/before-script.sh new file mode 100755 index 0000000..cce51a6 --- /dev/null +++ b/travis/before-script.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +# Magic `sed` command that replaces the last occurrence of `FROM alpine` with `FROM arm32v7/alpine` +# if base architecture of the final stage needs changing. Don't ask me about the "3". +if [[ "${ARCH}" = "arm" ]]; then + sed -i '3,\|^FROM alpine| s|FROM alpine|FROM arm32v7/alpine|' ${PREFIX}/Dockerfile* + echo "${PREFIX}/Dockerfile modified: Final stage image, base CPU architecture changed to: arm32v7" +fi diff --git a/travis/docker-manifest.sh b/travis/docker-manifest.sh new file mode 100755 index 0000000..e9dce4b --- /dev/null +++ b/travis/docker-manifest.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +# make sure Docker's config folder exists +mkdir -p ~/.docker + +# Putting experimental:true to config enables manifest options +echo '{ "experimental": "enabled" }' > ~/.docker/config.json + +# put above config into effect +sudo systemctl restart docker + +echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + +# print this to verify manifest options are now available +docker version + +# Example: lncm/bitcoind:0.18.0 +IMAGE_VERSIONED="${SLUG}:${TRAVIS_TAG}" +IMAGE_AMD64="${IMAGE_VERSIONED}-linux-amd64" +#IMAGE_ARM7="${IMAGE_VERSIONED}-linux-armv7" + +docker pull "${IMAGE_AMD64}" +#docker pull "${IMAGE_ARM7}" + + +echo "Pushing manifest ${IMAGE_VERSIONED}" +docker -D manifest create "${IMAGE_VERSIONED}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" +#docker manifest annotate "${IMAGE_VERSIONED}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_VERSIONED}" + + +# example: lncm/bitcoind:0.18 +IMAGE_MINOR_VER="${SLUG}:${VER}" + +echo "Pushing manifest ${IMAGE_MINOR_VER}" +docker -D manifest create "${IMAGE_MINOR_VER}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" +#docker manifest annotate "${IMAGE_MINOR_VER}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_MINOR_VER}" + + +#example: lncm/bitcoind:latest +IMAGE_LATEST="${SLUG}:latest" + +echo "Pushing manifest ${IMAGE_LATEST}" +docker -D manifest create "${IMAGE_LATEST}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" +#docker manifest annotate "${IMAGE_LATEST}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_LATEST}" diff --git a/travis/script.sh b/travis/script.sh new file mode 100755 index 0000000..3deff2b --- /dev/null +++ b/travis/script.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -e + +TAG=$(echo ${SLUG} | cut -d/ -f2) + +# Build image for specified architecture, if specified +if [[ ! -z "${ARCH}" ]]; then + # TODO: if SOURCE=binary: use another Dockerfile instead + if [[ "${SOURCE}" = "binary" ]]; then + echo "installation from binary not yet implemented" + exit 0 + fi + + docker build --no-cache -t ${TAG} "${PREFIX}/" + + # Push image, if tag was specified + if [[ -n "${TRAVIS_TAG}" ]]; then + echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + + docker tag ${TAG} "${SLUG}:${TRAVIS_TAG}-${ARCH}" + docker push "${SLUG}:${TRAVIS_TAG}-${ARCH}" + fi + + exit 0 +fi + +# This happens when no ARCH was provided. Specifically, in the deploy job. +echo "Saving images" + +LATEST_AMD64="${SLUG}:${TRAVIS_TAG}-linux-amd64" +#LATEST_ARM7="${SLUG}:${TRAVIS_TAG}-linux-armv7" + +mkdir images + +docker pull ${LATEST_AMD64} +docker save ${LATEST_AMD64} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-linux-amd64.tgz" + +#docker pull ${LATEST_ARM7} +#docker save ${LATEST_ARM7} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-linux-armv7.tgz" From b2d6cf1ae373a0e0fbf2310e06bcb041ffb7d843 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Fri, 3 May 2019 15:05:17 +0700 Subject: [PATCH 02/30] missing suffix part added --- travis/script.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/travis/script.sh b/travis/script.sh index 3deff2b..dadde6d 100755 --- a/travis/script.sh +++ b/travis/script.sh @@ -17,8 +17,8 @@ if [[ ! -z "${ARCH}" ]]; then if [[ -n "${TRAVIS_TAG}" ]]; then echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin - docker tag ${TAG} "${SLUG}:${TRAVIS_TAG}-${ARCH}" - docker push "${SLUG}:${TRAVIS_TAG}-${ARCH}" + docker tag ${TAG} "${SLUG}:${TRAVIS_TAG}-linux-${ARCH}" + docker push "${SLUG}:${TRAVIS_TAG}-linux-${ARCH}" fi exit 0 From 753842ce523cabba1332968fd7f040c7c7ad8840 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Fri, 3 May 2019 23:47:30 +0700 Subject: [PATCH 03/30] test alpine chroot --- .travis.yml | 31 +++++++---- {travis => .travis}/before-script.sh | 6 ++- .travis/build-amd64.sh | 21 ++++++++ .travis/build-arm.sh | 27 ++++++++++ .travis/docker-manifest.sh | 78 ++++++++++++++++++++++++++++ .travis/pull-all.sh | 23 ++++++++ 0.18/binary/Dockerfile | 59 +++++++++++++++++++++ 0.18/{ => source}/Dockerfile | 0 travis/docker-manifest.sh | 48 ----------------- travis/script.sh | 39 -------------- 10 files changed, 235 insertions(+), 97 deletions(-) rename {travis => .travis}/before-script.sh (82%) create mode 100755 .travis/build-amd64.sh create mode 100755 .travis/build-arm.sh create mode 100755 .travis/docker-manifest.sh create mode 100755 .travis/pull-all.sh create mode 100644 0.18/binary/Dockerfile rename 0.18/{ => source}/Dockerfile (100%) delete mode 100755 travis/docker-manifest.sh delete mode 100755 travis/script.sh diff --git a/.travis.yml b/.travis.yml index 9fb234d..e07bc9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,18 +26,21 @@ stages: jobs: include: - stage: build - name: "Build Docker image from source for amd64" - env: ARCH=amd64 SOURCE=code + name: "Build Docker image from SOURCE for amd64" + env: ARCH=amd64 FROM=source - - name: "Build Docker image from binary for amd64" - env: ARCH=amd64 SOURCE=binary +# - name: "Build Docker image from BINARY for amd64" +# env: ARCH=amd64 FROM=binary -# - name: "Build Docker image from binary for arm" -# env: ARCH=arm SOURCE=binary + - name: "Build Docker image from SOURCE for arm" + env: ARCH=arm FROM=source + +# - name: "Build Docker image from BINARY for arm" +# env: ARCH=arm FROM=binary - stage: deploy name: "Aggregate Docker images under one manifest" - script: ./travis/docker-manifest.sh + script: ./.travis/docker-manifest.sh - name: "Upload Docker containers to Github Releases" deploy: @@ -51,6 +54,16 @@ jobs: repo: lncm/docker-bitcoind tags: true -before_script: ./travis/before-script.sh -script: ./travis/script.sh +before_script: ./.travis/before-script.sh +script: + - > + if [[ "${ARCH}" = "amd64" ]]; then + ./.travis/build-amd64.sh + + elif [[ "${ARCH}" = "arm" ]]; then + ./.travis/build-arm.sh + + elif [[ ! -z "${ARCH}" ]]; then + ./.travis/pull-all.sh + fi diff --git a/travis/before-script.sh b/.travis/before-script.sh similarity index 82% rename from travis/before-script.sh rename to .travis/before-script.sh index cce51a6..db35c53 100755 --- a/travis/before-script.sh +++ b/.travis/before-script.sh @@ -1,9 +1,13 @@ #!/bin/bash set -e +if [[ ! -z "${FROM}" ]]; then + PREFIX="${PREFIX}/${FROM}" +fi + # Magic `sed` command that replaces the last occurrence of `FROM alpine` with `FROM arm32v7/alpine` # if base architecture of the final stage needs changing. Don't ask me about the "3". if [[ "${ARCH}" = "arm" ]]; then - sed -i '3,\|^FROM alpine| s|FROM alpine|FROM arm32v7/alpine|' ${PREFIX}/Dockerfile* + sed -i '3,\|^FROM alpine| s|FROM alpine|FROM arm32v7/alpine|' ${PREFIX}/Dockerfile echo "${PREFIX}/Dockerfile modified: Final stage image, base CPU architecture changed to: arm32v7" fi diff --git a/.travis/build-amd64.sh b/.travis/build-amd64.sh new file mode 100755 index 0000000..aed24eb --- /dev/null +++ b/.travis/build-amd64.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" + +BUILD_ARG="" +if [[ "${FROM}" = "binary" ]]; then + BUILD_ARG="arch=x86_64" +fi + +docker build --no-cache --build-arg "${BUILD_ARG}" -t ${TAG} ${PREFIX}/ + +# Push image, if tag was specified +if [[ -n "${TRAVIS_TAG}" ]]; then + echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + + docker push "${TAG}" +fi + + + diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh new file mode 100755 index 0000000..49604fe --- /dev/null +++ b/.travis/build-arm.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.10.0/alpine-chroot-install \ + && echo 'dcceb34aa63767579f533a7f2e733c4d662b0d1b alpine-chroot-install' | sha1sum -c \ + || exit 1 + +chmod +x alpine-chroot-install +./alpine-chroot-install -a armv7 -b v3.9 + +/alpine/enter-chroot uname -a +/alpine/enter-chroot env + + +TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" + +docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/ + +# Push image, if tag was specified +if [[ -n "${TRAVIS_TAG}" ]]; then + echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + + docker push "${TAG}" +fi + + + diff --git a/.travis/docker-manifest.sh b/.travis/docker-manifest.sh new file mode 100755 index 0000000..109f671 --- /dev/null +++ b/.travis/docker-manifest.sh @@ -0,0 +1,78 @@ +#!/bin/bash +set -e + +# make sure Docker's config folder exists +mkdir -p ~/.docker + +# Putting experimental:true to config enables manifest options +echo '{ "experimental": "enabled" }' > ~/.docker/config.json + +# put above config into effect +sudo systemctl restart docker + +echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin + +# print this to verify manifest options are now available +docker version + + + +# Example: lncm/bitcoind:0.18.0 +IMAGE_VERSIONED="${SLUG}:${TRAVIS_TAG}" +IMAGE_AMD64_SRC="${IMAGE_VERSIONED}-source-linux-amd64" +#IMAGE_ARM7_SRC="${IMAGE_VERSIONED}-source-linux-armv7" + +docker pull "${IMAGE_AMD64_SRC}" +#docker pull "${IMAGE_ARM7_SRC}" + +echo "Pushing manifest ${IMAGE_VERSIONED}" +docker -D manifest create "${IMAGE_VERSIONED}" "${IMAGE_AMD64_SRC}" #"${IMAGE_ARM7_SRC}" +#docker manifest annotate "${IMAGE_VERSIONED}" "${IMAGE_ARM7_SRC}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_VERSIONED}" + +# example: lncm/bitcoind:0.18 +IMAGE_MINOR_VER="${SLUG}:${VER}" + +echo "Pushing manifest ${IMAGE_MINOR_VER}" +docker -D manifest create "${IMAGE_MINOR_VER}" "${IMAGE_AMD64_SRC}" #"${IMAGE_ARM7_SRC}" +#docker manifest annotate "${IMAGE_MINOR_VER}" "${IMAGE_ARM7_SRC}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_MINOR_VER}" + +#example: lncm/bitcoind:latest +IMAGE_LATEST="${SLUG}:latest" + +echo "Pushing manifest ${IMAGE_LATEST}" +docker -D manifest create "${IMAGE_LATEST}" "${IMAGE_AMD64_SRC}" #"${IMAGE_ARM7_SRC}" +#docker manifest annotate "${IMAGE_LATEST}" "${IMAGE_ARM7_SRC}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_LATEST}" + + + +# Example: lncm/bitcoind:0.18.0-binary +IMAGE_VERSIONED="${SLUG}:${TRAVIS_TAG}-binary" +IMAGE_AMD64_BIN="${IMAGE_VERSIONED}-binary-linux-amd64" +#IMAGE_ARM7_BIN="${IMAGE_VERSIONED}-binary-linux-armv7" + +docker pull "${IMAGE_AMD64_BIN}" +#docker pull "${IMAGE_ARM7_BIN}" + +echo "Pushing manifest ${IMAGE_VERSIONED}" +docker -D manifest create "${IMAGE_VERSIONED}" "${IMAGE_AMD64_BIN}" #"${IMAGE_ARM7_BIN}" +#docker manifest annotate "${IMAGE_VERSIONED}" "${IMAGE_ARM7_BIN}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_VERSIONED}" + +# example: lncm/bitcoind:0.18-binary +IMAGE_MINOR_VER="${SLUG}:${VER}-binary" + +echo "Pushing manifest ${IMAGE_MINOR_VER}" +docker -D manifest create "${IMAGE_MINOR_VER}" "${IMAGE_AMD64_BIN}" #"${IMAGE_ARM7_BIN}" +#docker manifest annotate "${IMAGE_MINOR_BIN}" "${IMAGE_ARM7_BIN}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_MINOR_VER}" + +#example: lncm/bitcoind:binary +IMAGE_BINARY="${SLUG}:binary" + +echo "Pushing manifest ${IMAGE_BINARY}" +docker -D manifest create "${IMAGE_BINARY}" "${IMAGE_AMD64_BIN}" #"${IMAGE_ARM7_BIN}" +#docker manifest annotate "${IMAGE_BINARY}" "${IMAGE_ARM7_BIN}" --os linux --arch arm --variant v7 +docker manifest push "${IMAGE_BINARY}" diff --git a/.travis/pull-all.sh b/.travis/pull-all.sh new file mode 100755 index 0000000..7aaac4d --- /dev/null +++ b/.travis/pull-all.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +echo "Saving images…" + +LATEST_AMD64_SRC="${SLUG}:${TRAVIS_TAG}-source-linux-amd64" +LATEST_AMD64_BIN="${SLUG}:${TRAVIS_TAG}-binary-linux-amd64" +#LATEST_ARM7_SRC="${SLUG}:${TRAVIS_TAG}-source-linux-armv7" +#LATEST_ARM7_BIN="${SLUG}:${TRAVIS_TAG}-binary-linux-armv7" + +mkdir images + +docker pull ${LATEST_AMD64_SRC} +docker save ${LATEST_AMD64_SRC} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-source-linux-amd64.tgz" + +docker pull ${LATEST_AMD64_BIN} +docker save ${LATEST_AMD64_BIN} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-binary-linux-amd64.tgz" + +#docker pull ${LATEST_ARM7_SRC} +#docker save ${LATEST_ARM7_SRC} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-source-linux-armv7.tgz" + +#docker pull ${LATEST_ARM7_BIN} +#docker save ${LATEST_ARM7_BIN} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-binary-linux-armv7.tgz" diff --git a/0.18/binary/Dockerfile b/0.18/binary/Dockerfile new file mode 100644 index 0000000..5a215da --- /dev/null +++ b/0.18/binary/Dockerfile @@ -0,0 +1,59 @@ +# Build stage for Bitcoin Core +FROM alpine:3.9 AS bitcoin-core + + + + +#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 protobuf-dev +#RUN apk --no-cache add zeromq-dev +RUN set -ex \ + && for key in \ + 90C8019E36C2E964 \ + ; do \ + gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ + gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done + +ENV BITCOIN_VERSION=0.18.0 + +ARG arch +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}-${arch}-linux-gnu.tar.gz +RUN gpg --verify SHA256SUMS.asc +RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - +RUN tar -xzf *.tar.gz + +RUN install -m 0755 -o root -g root -t /usr/local/bin bitcoin-${BITCOIN_VERSION}/bin/* + +LABEL maintainer.0="nolim1t (@nolim1t)" \ + maintainer.1="Damian Mee (@meeDamian)" + +VOLUME /root/.bitcoin + +COPY --from=bitcoin-core /opt /opt + +# Ports: +# 8080 - +# 8332 - RPC main net +# 8333 - P2P network main net +# 18332 - RPC test net +# 18443 - RPC reg net + +EXPOSE 8080 8332 8333 18332 18333 18444 28333 28332 + +ENTRYPOINT ["bitcoind"] +CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/Dockerfile b/0.18/source/Dockerfile similarity index 100% rename from 0.18/Dockerfile rename to 0.18/source/Dockerfile diff --git a/travis/docker-manifest.sh b/travis/docker-manifest.sh deleted file mode 100755 index e9dce4b..0000000 --- a/travis/docker-manifest.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e - -# make sure Docker's config folder exists -mkdir -p ~/.docker - -# Putting experimental:true to config enables manifest options -echo '{ "experimental": "enabled" }' > ~/.docker/config.json - -# put above config into effect -sudo systemctl restart docker - -echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin - -# print this to verify manifest options are now available -docker version - -# Example: lncm/bitcoind:0.18.0 -IMAGE_VERSIONED="${SLUG}:${TRAVIS_TAG}" -IMAGE_AMD64="${IMAGE_VERSIONED}-linux-amd64" -#IMAGE_ARM7="${IMAGE_VERSIONED}-linux-armv7" - -docker pull "${IMAGE_AMD64}" -#docker pull "${IMAGE_ARM7}" - - -echo "Pushing manifest ${IMAGE_VERSIONED}" -docker -D manifest create "${IMAGE_VERSIONED}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" -#docker manifest annotate "${IMAGE_VERSIONED}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 -docker manifest push "${IMAGE_VERSIONED}" - - -# example: lncm/bitcoind:0.18 -IMAGE_MINOR_VER="${SLUG}:${VER}" - -echo "Pushing manifest ${IMAGE_MINOR_VER}" -docker -D manifest create "${IMAGE_MINOR_VER}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" -#docker manifest annotate "${IMAGE_MINOR_VER}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 -docker manifest push "${IMAGE_MINOR_VER}" - - -#example: lncm/bitcoind:latest -IMAGE_LATEST="${SLUG}:latest" - -echo "Pushing manifest ${IMAGE_LATEST}" -docker -D manifest create "${IMAGE_LATEST}" "${IMAGE_AMD64}" #"${IMAGE_ARM7}" -#docker manifest annotate "${IMAGE_LATEST}" "${IMAGE_ARM7}" --os linux --arch arm --variant v7 -docker manifest push "${IMAGE_LATEST}" diff --git a/travis/script.sh b/travis/script.sh deleted file mode 100755 index dadde6d..0000000 --- a/travis/script.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -e - -TAG=$(echo ${SLUG} | cut -d/ -f2) - -# Build image for specified architecture, if specified -if [[ ! -z "${ARCH}" ]]; then - # TODO: if SOURCE=binary: use another Dockerfile instead - if [[ "${SOURCE}" = "binary" ]]; then - echo "installation from binary not yet implemented" - exit 0 - fi - - docker build --no-cache -t ${TAG} "${PREFIX}/" - - # Push image, if tag was specified - if [[ -n "${TRAVIS_TAG}" ]]; then - echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin - - docker tag ${TAG} "${SLUG}:${TRAVIS_TAG}-linux-${ARCH}" - docker push "${SLUG}:${TRAVIS_TAG}-linux-${ARCH}" - fi - - exit 0 -fi - -# This happens when no ARCH was provided. Specifically, in the deploy job. -echo "Saving images" - -LATEST_AMD64="${SLUG}:${TRAVIS_TAG}-linux-amd64" -#LATEST_ARM7="${SLUG}:${TRAVIS_TAG}-linux-armv7" - -mkdir images - -docker pull ${LATEST_AMD64} -docker save ${LATEST_AMD64} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-linux-amd64.tgz" - -#docker pull ${LATEST_ARM7} -#docker save ${LATEST_ARM7} | gzip > "images/${SLUG/\//-}-${TRAVIS_TAG}-linux-armv7.tgz" From 263d643e5955f0912e914ad915e421199d910ea9 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Fri, 3 May 2019 23:54:52 +0700 Subject: [PATCH 04/30] avoid empty build-arg --- .travis/build-amd64.sh | 6 ++++-- .travis/build-arm.sh | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis/build-amd64.sh b/.travis/build-amd64.sh index aed24eb..172702b 100755 --- a/.travis/build-amd64.sh +++ b/.travis/build-amd64.sh @@ -3,9 +3,11 @@ set -e TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" -BUILD_ARG="" if [[ "${FROM}" = "binary" ]]; then - BUILD_ARG="arch=x86_64" + docker build --no-cache --build-arg "arch=x86_64" -t ${TAG} ${PREFIX}/ + +else + docker build --no-cache -t ${TAG} ${PREFIX}/ fi docker build --no-cache --build-arg "${BUILD_ARG}" -t ${TAG} ${PREFIX}/ diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh index 49604fe..0d94c6c 100755 --- a/.travis/build-arm.sh +++ b/.travis/build-arm.sh @@ -14,7 +14,12 @@ chmod +x alpine-chroot-install TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" -docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/ +if [[ "${FROM}" = "binary" ]]; then + docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/ + +else + docker build --no-cache -t ${TAG} ${PREFIX}/ +fi # Push image, if tag was specified if [[ -n "${TRAVIS_TAG}" ]]; then From fea1df69a94af6c1b52f992a9aa6dd500bc30483 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:00:34 +0700 Subject: [PATCH 05/30] add logging --- .travis/build-amd64.sh | 3 ++- .travis/build-arm.sh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis/build-amd64.sh b/.travis/build-amd64.sh index 172702b..c39dc90 100755 --- a/.travis/build-amd64.sh +++ b/.travis/build-amd64.sh @@ -3,6 +3,8 @@ set -e TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" +echo "Building ${TAG} with ${PREFIX}/Dockerfile…" + if [[ "${FROM}" = "binary" ]]; then docker build --no-cache --build-arg "arch=x86_64" -t ${TAG} ${PREFIX}/ @@ -10,7 +12,6 @@ else docker build --no-cache -t ${TAG} ${PREFIX}/ fi -docker build --no-cache --build-arg "${BUILD_ARG}" -t ${TAG} ${PREFIX}/ # Push image, if tag was specified if [[ -n "${TRAVIS_TAG}" ]]; then diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh index 0d94c6c..13898eb 100755 --- a/.travis/build-arm.sh +++ b/.travis/build-arm.sh @@ -14,6 +14,8 @@ chmod +x alpine-chroot-install TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" +echo "Building ${TAG} with ${PREFIX}/Dockerfile…" + if [[ "${FROM}" = "binary" ]]; then docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/ @@ -21,6 +23,7 @@ else docker build --no-cache -t ${TAG} ${PREFIX}/ fi + # Push image, if tag was specified if [[ -n "${TRAVIS_TAG}" ]]; then echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin From 6d111bd21d63ce64dc8ca77951b5cc43d1383e1c Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:03:05 +0700 Subject: [PATCH 06/30] remove unnecessary before_script --- .travis/before-script.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis/before-script.sh b/.travis/before-script.sh index db35c53..63a661a 100755 --- a/.travis/before-script.sh +++ b/.travis/before-script.sh @@ -1,13 +1,13 @@ #!/bin/bash set -e -if [[ ! -z "${FROM}" ]]; then - PREFIX="${PREFIX}/${FROM}" -fi +#if [[ ! -z "${FROM}" ]]; then +# PREFIX="${PREFIX}/${FROM}" +#fi -# Magic `sed` command that replaces the last occurrence of `FROM alpine` with `FROM arm32v7/alpine` -# if base architecture of the final stage needs changing. Don't ask me about the "3". -if [[ "${ARCH}" = "arm" ]]; then - sed -i '3,\|^FROM alpine| s|FROM alpine|FROM arm32v7/alpine|' ${PREFIX}/Dockerfile - echo "${PREFIX}/Dockerfile modified: Final stage image, base CPU architecture changed to: arm32v7" -fi +## Magic `sed` command that replaces the last occurrence of `FROM alpine` with `FROM arm32v7/alpine` +## if base architecture of the final stage needs changing. Don't ask me about the "3". +#if [[ "${ARCH}" = "arm" ]]; then +# sed -i '3,\|^FROM alpine| s|FROM alpine|FROM arm32v7/alpine|' ${PREFIX}/Dockerfile +# echo "${PREFIX}/Dockerfile modified: Final stage image, base CPU architecture changed to: arm32v7" +#fi From f3e08b5dbffdd40b1bb5e0f7be6d248dbbc94ab0 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:03:18 +0700 Subject: [PATCH 07/30] fix paths to Dockerfiles --- .travis/build-amd64.sh | 4 ++-- .travis/build-arm.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis/build-amd64.sh b/.travis/build-amd64.sh index c39dc90..073097d 100755 --- a/.travis/build-amd64.sh +++ b/.travis/build-amd64.sh @@ -6,10 +6,10 @@ TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" echo "Building ${TAG} with ${PREFIX}/Dockerfile…" if [[ "${FROM}" = "binary" ]]; then - docker build --no-cache --build-arg "arch=x86_64" -t ${TAG} ${PREFIX}/ + docker build --no-cache --build-arg "arch=x86_64" -t ${TAG} ${PREFIX}/${FROM}/ else - docker build --no-cache -t ${TAG} ${PREFIX}/ + docker build --no-cache -t ${TAG} ${PREFIX}/${FROM}/ fi diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh index 13898eb..85eaaef 100755 --- a/.travis/build-arm.sh +++ b/.travis/build-arm.sh @@ -17,10 +17,10 @@ TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" echo "Building ${TAG} with ${PREFIX}/Dockerfile…" if [[ "${FROM}" = "binary" ]]; then - docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/ + docker build --no-cache --build-arg "arch=${ARCH}" -t ${TAG} ${PREFIX}/${FROM}/ else - docker build --no-cache -t ${TAG} ${PREFIX}/ + docker build --no-cache -t ${TAG} ${PREFIX}/${FROM}/ fi From 8a07aa4543b603b6391f8ec33d0723269c51fb19 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:05:03 +0700 Subject: [PATCH 08/30] run chroot as root --- .travis/build-arm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh index 85eaaef..1fd60f6 100755 --- a/.travis/build-arm.sh +++ b/.travis/build-arm.sh @@ -6,11 +6,12 @@ wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.10.0 || exit 1 chmod +x alpine-chroot-install -./alpine-chroot-install -a armv7 -b v3.9 +sudo ./alpine-chroot-install -a armv7 -b v3.9 /alpine/enter-chroot uname -a /alpine/enter-chroot env +apk add docker TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" From 3e68ca6b71d0217520cd9290ebf38f918e06282f Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:12:08 +0700 Subject: [PATCH 09/30] split chroot --- .travis.yml | 9 ++++++++- .travis/build-arm.sh | 10 ---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index e07bc9c..15338fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,14 @@ script: ./.travis/build-amd64.sh elif [[ "${ARCH}" = "arm" ]]; then - ./.travis/build-arm.sh + wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.10.0/alpine-chroot-install \ + && echo 'dcceb34aa63767579f533a7f2e733c4d662b0d1b alpine-chroot-install' | sha1sum -c \ + || exit 1 + + chmod +x alpine-chroot-install + sudo ./alpine-chroot-install -a armv7 -b v3.9 + + /alpine/enter-chroot ./.travis/build-arm.sh elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh diff --git a/.travis/build-arm.sh b/.travis/build-arm.sh index 1fd60f6..ced5f9b 100755 --- a/.travis/build-arm.sh +++ b/.travis/build-arm.sh @@ -1,16 +1,6 @@ #!/bin/bash set -e -wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.10.0/alpine-chroot-install \ - && echo 'dcceb34aa63767579f533a7f2e733c4d662b0d1b alpine-chroot-install' | sha1sum -c \ - || exit 1 - -chmod +x alpine-chroot-install -sudo ./alpine-chroot-install -a armv7 -b v3.9 - -/alpine/enter-chroot uname -a -/alpine/enter-chroot env - apk add docker TAG="${SLUG}:${TRAVIS_TAG:-$TRAVIS_BRANCH}-${FROM}-linux-${ARCH}" From 159a34e3006481e54c1310f159498e7adff826f3 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:25:23 +0700 Subject: [PATCH 10/30] disable amd64 builds --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 15338fb..62bffcc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,14 +25,15 @@ stages: jobs: include: - - stage: build - name: "Build Docker image from SOURCE for amd64" - env: ARCH=amd64 FROM=source +# - stage: build +# name: "Build Docker image from SOURCE for amd64" +# env: ARCH=amd64 FROM=source # - name: "Build Docker image from BINARY for amd64" # env: ARCH=amd64 FROM=binary - - name: "Build Docker image from SOURCE for arm" + - stage: build + name: "Build Docker image from SOURCE for arm" env: ARCH=arm FROM=source # - name: "Build Docker image from BINARY for arm" @@ -68,7 +69,9 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armv7 -b v3.9 - /alpine/enter-chroot ./.travis/build-arm.sh + cp ./.travis/build-arm.sh /alpine/ + + /alpine/enter-chroot ./build-arm.sh elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 58f8b5b7048a8a765766648f99508deca018e091 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:27:34 +0700 Subject: [PATCH 11/30] fix file copy --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62bffcc..f83ab31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,9 +69,9 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armv7 -b v3.9 - cp ./.travis/build-arm.sh /alpine/ + sudo cp ./.travis/build-arm.sh /alpine/ - /alpine/enter-chroot ./build-arm.sh + /alpine/enter-chroot /build-arm.sh elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 452f8825fa3db443f106e9396c23791165c8c613 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:30:35 +0700 Subject: [PATCH 12/30] list stuff --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f83ab31..aa3dcd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,6 +71,9 @@ script: sudo cp ./.travis/build-arm.sh /alpine/ + /alpine/enter-chroot ls -la / + /alpine/enter-chroot ls -la /alpine/ + /alpine/enter-chroot /build-arm.sh elif [[ ! -z "${ARCH}" ]]; then From ac226693dde741428a72b8c59c249870de35fe93 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:35:23 +0700 Subject: [PATCH 13/30] list & run --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa3dcd1..f13cef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,8 +72,6 @@ script: sudo cp ./.travis/build-arm.sh /alpine/ /alpine/enter-chroot ls -la / - /alpine/enter-chroot ls -la /alpine/ - /alpine/enter-chroot /build-arm.sh elif [[ ! -z "${ARCH}" ]]; then From 4ab6c6b7ee70a5e1eb0d0081a6cde5594ca796cc Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:39:59 +0700 Subject: [PATCH 14/30] quote the path --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f13cef0..5afcc04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,8 +71,8 @@ script: sudo cp ./.travis/build-arm.sh /alpine/ - /alpine/enter-chroot ls -la / - /alpine/enter-chroot /build-arm.sh + /alpine/enter-chroot ls -la / + /alpine/enter-chroot "/build-arm.sh" elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From d099462d28f3f58343d60c250fe62788d0eccd2e Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:47:09 +0700 Subject: [PATCH 15/30] check bound path --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5afcc04..25f3634 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,7 +71,7 @@ script: sudo cp ./.travis/build-arm.sh /alpine/ - /alpine/enter-chroot ls -la / + /alpine/enter-chroot ls -la /alpine/home/travis/build/lncm/docker-bitcoind /alpine/enter-chroot "/build-arm.sh" elif [[ ! -z "${ARCH}" ]]; then From ed4c8b9e339a3b8601961b772f98ab1b86748060 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:49:16 +0700 Subject: [PATCH 16/30] test path v2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 25f3634..619e889 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,7 +71,7 @@ script: sudo cp ./.travis/build-arm.sh /alpine/ - /alpine/enter-chroot ls -la /alpine/home/travis/build/lncm/docker-bitcoind + /alpine/enter-chroot ls -la /home/travis/build/lncm/docker-bitcoind/ /alpine/enter-chroot "/build-arm.sh" elif [[ ! -z "${ARCH}" ]]; then From f19ecacff6799f031788421e8ef820a0b46cf053 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:52:44 +0700 Subject: [PATCH 17/30] call abs path --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 619e889..a7fc80f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,10 +69,8 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armv7 -b v3.9 - sudo cp ./.travis/build-arm.sh /alpine/ - - /alpine/enter-chroot ls -la /home/travis/build/lncm/docker-bitcoind/ - /alpine/enter-chroot "/build-arm.sh" + /alpine/enter-chroot ls -la ./ + /alpine/enter-chroot /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 351aaf372187f4fdf294897cbbe4c3b247f3cba3 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 00:56:45 +0700 Subject: [PATCH 18/30] I'm slowly getting desperate --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a7fc80f..95ea937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -70,7 +70,10 @@ script: sudo ./alpine-chroot-install -a armv7 -b v3.9 /alpine/enter-chroot ls -la ./ - /alpine/enter-chroot /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh + /alpine/enter-chroot ls -la /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh + + /alpine/enter-chroot /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh || true + /alpine/enter-chroot ./.travis/build-arm.sh || true elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From cc729861ccc1d23e1ca25ed53ef2a161bae2fbc8 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 01:12:09 +0700 Subject: [PATCH 19/30] a yet another attempt. --- .travis.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95ea937..cc192a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,11 +69,8 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armv7 -b v3.9 - /alpine/enter-chroot ls -la ./ - /alpine/enter-chroot ls -la /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh - - /alpine/enter-chroot /home/travis/build/lncm/docker-bitcoind/.travis/build-arm.sh || true - /alpine/enter-chroot ./.travis/build-arm.sh || true + /alpine/enter-chroot ls -la ./.travis/ + /alpine/enter-chroot '.travis/build-arm.sh' elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 2f28cf97561d3698fd2734e667ddf36eaaff5905 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 4 May 2019 01:34:36 +0700 Subject: [PATCH 20/30] =?UTF-8?q?c=20at=20enter-chroot=20script=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index cc192a2..3922822 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,6 +69,8 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armv7 -b v3.9 + cat /alpine/enter-chroot + /alpine/enter-chroot ls -la ./.travis/ /alpine/enter-chroot '.travis/build-arm.sh' From 4cde49bc3dbd957cd3d64c2f3432d2973c8f5dfb Mon Sep 17 00:00:00 2001 From: Another Droog <36770425+AnotherDroog@users.noreply.github.com> Date: Mon, 6 May 2019 13:53:39 +0700 Subject: [PATCH 21/30] Explicit sh --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3922822..eb3e26a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,12 +67,12 @@ script: || exit 1 chmod +x alpine-chroot-install - sudo ./alpine-chroot-install -a armv7 -b v3.9 + sudo ./alpine-chroot-install -a armhf -b v3.9 cat /alpine/enter-chroot - /alpine/enter-chroot ls -la ./.travis/ - /alpine/enter-chroot '.travis/build-arm.sh' + sh /alpine/enter-chroot 'ls -la ./.travis/' + sh /alpine/enter-chroot 'sh .travis/build-arm.sh' elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 6388f88a74378931f8947523ee19e0395202ac5e Mon Sep 17 00:00:00 2001 From: Another Droog <36770425+AnotherDroog@users.noreply.github.com> Date: Mon, 6 May 2019 14:15:31 +0700 Subject: [PATCH 22/30] test --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index eb3e26a..877ec02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,8 +71,8 @@ script: cat /alpine/enter-chroot - sh /alpine/enter-chroot 'ls -la ./.travis/' - sh /alpine/enter-chroot 'sh .travis/build-arm.sh' + /alpine/enter-chroot ls -la ~/.travis/ + /alpine/enter-chroot sh ~/.travis/build-arm.sh elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 915bfcd9c6043f14467245a2e9ebf7a387153bc4 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 11 May 2019 14:45:47 +0700 Subject: [PATCH 24/30] improve docs --- 0.18/binary/Dockerfile | 19 +++++++++++-------- 0.18/source/Dockerfile | 32 +++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/0.18/binary/Dockerfile b/0.18/binary/Dockerfile index 5a215da..e898f00 100644 --- a/0.18/binary/Dockerfile +++ b/0.18/binary/Dockerfile @@ -46,14 +46,17 @@ VOLUME /root/.bitcoin COPY --from=bitcoin-core /opt /opt -# Ports: -# 8080 - -# 8332 - RPC main net -# 8333 - P2P network main net -# 18332 - RPC test net -# 18443 - RPC reg net - -EXPOSE 8080 8332 8333 18332 18333 18444 28333 28332 +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 + +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 ENTRYPOINT ["bitcoind"] CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/source/Dockerfile b/0.18/source/Dockerfile index e22fe71..3099cf5 100644 --- a/0.18/source/Dockerfile +++ b/0.18/source/Dockerfile @@ -4,6 +4,7 @@ FROM alpine:3.9 AS bitcoin-core # fetch already built berkeleydb COPY --from=lncm/berkeleydb:db-4.8.30.NC /opt /opt +# Replace `http:` repositories with `https:` ones 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 @@ -34,15 +35,26 @@ 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 + +# Verify that hashes are signed with the previously imported key RUN gpg --verify SHA256SUMS.asc + +# Verify that downloaded source-code archive has exactly the hash that's provided RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - + +# Extract RUN tar -xzf *.tar.gz +# Change to the extraced directory 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} \ @@ -56,6 +68,7 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl --with-daemon RUN make RUN make install + RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx RUN strip ${BITCOIN_PREFIX}/bin/bitcoind @@ -69,6 +82,8 @@ FROM alpine:3.9 AS final LABEL maintainer.0="nolim1t (@nolim1t)" \ maintainer.1="Damian Mee (@meeDamian)" +# TODO: Eliminating the two RUN lines below is necessary to cross-compile… +# Replace `http:` repositories with `https:` ones 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 \ @@ -86,14 +101,17 @@ VOLUME /root/.bitcoin COPY --from=bitcoin-core /opt /opt -# Ports: -# 8080 - -# 8332 - RPC main net -# 8333 - P2P network main net -# 18332 - RPC test net -# 18443 - RPC reg net +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 -EXPOSE 8080 8332 8333 18332 18333 18444 28333 28332 +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 ENTRYPOINT ["bitcoind"] CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] From b66a4d535e48260b5aa90ffb661e4ea5e18e4652 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 11 May 2019 14:46:49 +0700 Subject: [PATCH 25/30] apk add bash in chroot before running the script --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 877ec02..c86b34e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,10 +69,9 @@ script: chmod +x alpine-chroot-install sudo ./alpine-chroot-install -a armhf -b v3.9 - cat /alpine/enter-chroot - - /alpine/enter-chroot ls -la ~/.travis/ - /alpine/enter-chroot sh ~/.travis/build-arm.sh + /alpine/enter-chroot apk add bash + /alpine/enter-chroot ~/.travis/build-arm.sh || true + /alpine/enter-chroot ./.travis/build-arm.sh || true elif [[ ! -z "${ARCH}" ]]; then ./.travis/pull-all.sh From 8c00920b3daa493c790633ca5c12845bb8f9d223 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 11 May 2019 14:48:23 +0700 Subject: [PATCH 26/30] document ports --- 0.17/Dockerfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/0.17/Dockerfile b/0.17/Dockerfile index 8f40517..00f6fc5 100644 --- a/0.17/Dockerfile +++ b/0.17/Dockerfile @@ -86,7 +86,17 @@ VOLUME /root/.bitcoin COPY --from=bitcoin-core /opt /opt -EXPOSE 8080 8332 8333 18332 18333 18444 28333 28332 +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 + +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 ENTRYPOINT ["bitcoind"] CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] From 52827bb217e862868064d9f2a92f47f3ce83c28c Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 11 May 2019 14:49:00 +0700 Subject: [PATCH 27/30] merge multiple installs into one --- 0.18/source/Dockerfile | 48 ++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/0.18/source/Dockerfile b/0.18/source/Dockerfile index 3099cf5..91de542 100644 --- a/0.18/source/Dockerfile +++ b/0.18/source/Dockerfile @@ -6,20 +6,24 @@ COPY --from=lncm/berkeleydb:db-4.8.30.NC /opt /opt # Replace `http:` repositories with `https:` ones 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 protobuf-dev -RUN apk --no-cache add zeromq-dev + +# install packages necessary to build Bitcoind +RUN apk add --no-cache --update \ + autoconf \ + automake \ + boost-dev \ + build-base \ + chrpath \ + file \ + gnupg \ + libevent-dev \ + libressl \ + libressl-dev \ + libtool \ + linux-headers \ + protobuf-dev \ + zeromq-dev + RUN set -ex \ && for key in \ 90C8019E36C2E964 \ @@ -85,13 +89,15 @@ LABEL maintainer.0="nolim1t (@nolim1t)" \ # TODO: Eliminating the two RUN lines below is necessary to cross-compile… # Replace `http:` repositories with `https:` ones 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 \ - boost-program_options \ - libevent \ - libressl \ - libzmq \ - su-exec + +RUN apk --no-cache --update \ + add \ + boost \ + boost-program_options \ + libevent \ + libressl \ + libzmq \ + su-exec ENV BITCOIN_VERSION=0.18.0 ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} From fac97e1185e058adf913b7667b418ca8d184369d Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sat, 11 May 2019 14:49:49 +0700 Subject: [PATCH 28/30] download signed hashes from different source than source code --- 0.18/source/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/0.18/source/Dockerfile b/0.18/source/Dockerfile index 91de542..0834d62 100644 --- a/0.18/source/Dockerfile +++ b/0.18/source/Dockerfile @@ -37,7 +37,10 @@ RUN set -ex \ ENV BITCOIN_VERSION=0.18.0 ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} -RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc +# Download checksums (intentionally different source than source code) +RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc + +# Download source code (intentionally different source than checksums) RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz # Verify that hashes are signed with the previously imported key From 14539165fb885203e140f5e9cb944faad6786e9a Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Tue, 14 May 2019 15:07:06 +0700 Subject: [PATCH 29/30] test --- .travis.yml | 3 + 0.17/Dockerfile | 2 + 0.18/Dockerfile | 62 +++++++++++++++++++ 0.18/Dockerfile.bak | 136 +++++++++++++++++++++++++++++++++++++++++ 0.18/source/Dockerfile | 7 +-- 5 files changed, 206 insertions(+), 4 deletions(-) create mode 100644 0.18/Dockerfile create mode 100644 0.18/Dockerfile.bak diff --git a/.travis.yml b/.travis.yml index c86b34e..5c0179a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,9 @@ jobs: name: "Build Docker image from SOURCE for arm" env: ARCH=arm FROM=source + - name: "See how fast building toolchain works on Travis" + script: docker build 0.18/ + # - name: "Build Docker image from BINARY for arm" # env: ARCH=arm FROM=binary diff --git a/0.17/Dockerfile b/0.17/Dockerfile index 00f6fc5..49c646b 100644 --- a/0.17/Dockerfile +++ b/0.17/Dockerfile @@ -4,6 +4,7 @@ FROM alpine:3.9 AS bitcoin-core # fetch already built berkeleydb COPY --from=lncm/berkeleydb:db-4.8.30.NC /opt /opt +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 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 @@ -69,6 +70,7 @@ FROM alpine:3.9 AS final LABEL maintainer.0="nolim1t (@nolim1t)" \ maintainer.1="Damian Mee (@meeDamian)" +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 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 \ diff --git a/0.18/Dockerfile b/0.18/Dockerfile new file mode 100644 index 0000000..96e7e56 --- /dev/null +++ b/0.18/Dockerfile @@ -0,0 +1,62 @@ +# Build stage for Bitcoin Core +FROM alpine:3.9 AS bitcoin-core + +# fetch already built berkeleydb +COPY --from=lncm/berkeleydb:db-4.8.30.NC-linux-arm /opt /opt + +# Replace `http:` repositories with `https:` ones +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN echo 'https://alpine.global.ssl.fastly.net/alpine/edge/testing' >> /etc/apk/repositories + +# install packages necessary to build Bitcoind +RUN apk add --no-cache --update \ + autoconf \ + automake \ + boost-dev \ + build-base \ + chrpath \ + crosstool-ng \ + curl \ + file \ + g++ \ + gcc \ + git \ + gnupg \ + libevent-dev \ + libressl \ + libressl-dev \ + libtool \ + linux-headers \ + make \ + protobuf-dev \ + tar \ + wget \ + zeromq-dev + +# We are inside Docker container. It's easier to run as root, and no damage can be done anyway… so ¯\_(ツ)_/¯ +ENV CT_EXPERIMENTAL=y +ENV CT_ALLOW_BUILD_AS_ROOT=y +ENV CT_ALLOW_BUILD_AS_ROOT_SURE=y + +RUN apk add xz patch binutils + +RUN ct-ng arm-unknown-linux-musleabi + +RUN ct-ng -d build || true + +RUN tail -n 200 build.log + + + +# Alpine gotchas: +# +# `apk add --update wget` has to be run. +# Otherwise "wget: unrecognized option: progress=dot:binary" is returned +# +# `apk add --update tor` has to be run. +# Otherwise "tar: invalid tar magic" is returned +# +# `apk add --update patch` +# Otherwise: "/usr/bin/patch: unrecognized option: 0" +# +# Just missing & needs installing: xz strip (part of binutils) diff --git a/0.18/Dockerfile.bak b/0.18/Dockerfile.bak new file mode 100644 index 0000000..10389b9 --- /dev/null +++ b/0.18/Dockerfile.bak @@ -0,0 +1,136 @@ +# Build stage for Bitcoin Core +FROM alpine:3.9 AS bitcoin-core + +# fetch already built berkeleydb +COPY --from=lncm/berkeleydb:db-4.8.30.NC-linux-arm /opt /opt + +# Replace `http:` repositories with `https:` ones +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN echo 'https://alpine.global.ssl.fastly.net/alpine/edge/testing' >> /etc/apk/repositories + + +# install packages necessary to build Bitcoind +RUN apk add --no-cache --update \ + autoconf \ + automake \ + boost-dev \ + build-base \ + chrpath \ + curl \ + file \ +# g++ \ +# gcc-cross-embedded \ + crosstool-ng \ + git \ + gnupg \ + libevent-dev \ + libressl \ + libressl-dev \ + libtool \ + linux-headers \ + protobuf-dev \ + zeromq-dev + +#RUN set -ex \ +# && for key in \ +# 90C8019E36C2E964 \ +# ; do \ +# gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ +# gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ +# gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ +# gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ +# done + +ENV BITCOIN_VERSION=0.18.0 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} + +RUN git clone -b "v${BITCOIN_VERSION}" https://github.com/bitcoin/bitcoin.git + +# Download checksums (intentionally different source than source code) +#RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc + +# Download source code (intentionally different source than checksums) +#RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz + +# Verify that hashes are signed with the previously imported key +#RUN gpg --verify SHA256SUMS.asc + +# Verify that downloaded source-code archive has exactly the hash that's provided +#RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - + +# Extract +#RUN tar -xzf *.tar.gz + +# Change to the extraced directory +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 +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:3.9 AS final + +LABEL maintainer.0="nolim1t (@nolim1t)" \ + maintainer.1="Damian Mee (@meeDamian)" + +# TODO: Eliminating the two RUN lines below is necessary to cross-compile… +# Replace `http:` repositories with `https:` ones +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories + +RUN apk --no-cache --update + add \ + boost \ + boost-program_options \ + libevent \ + libressl \ + libzmq \ + su-exec + +ENV BITCOIN_VERSION=0.18.0 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH + +VOLUME /root/.bitcoin + +COPY --from=bitcoin-core /opt /opt + +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 + +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 + +ENTRYPOINT ["bitcoind"] +CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/source/Dockerfile b/0.18/source/Dockerfile index 0834d62..8941826 100644 --- a/0.18/source/Dockerfile +++ b/0.18/source/Dockerfile @@ -4,7 +4,7 @@ FROM alpine:3.9 AS bitcoin-core # fetch already built berkeleydb COPY --from=lncm/berkeleydb:db-4.8.30.NC /opt /opt -# Replace `http:` repositories with `https:` ones +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories # install packages necessary to build Bitcoind @@ -89,10 +89,9 @@ FROM alpine:3.9 AS final LABEL maintainer.0="nolim1t (@nolim1t)" \ maintainer.1="Damian Mee (@meeDamian)" -# TODO: Eliminating the two RUN lines below is necessary to cross-compile… -# Replace `http:` repositories with `https:` ones +# TODO: Eliminating the two RUN lines below is crucial to make cross-compilation possible… +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories - RUN apk --no-cache --update \ add \ boost \ From d80ac47eba13d4a0368468aeee934648648c2048 Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sun, 11 Aug 2019 15:58:36 +0700 Subject: [PATCH 30/30] test whitespace added --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e65bec5..4f3f922 100644 --- a/README.md +++ b/README.md @@ -89,3 +89,4 @@ docker exec -it bitcoind bitcoin-cli --help docker exec -it bitcoind bitcoin-cli -getinfo docker exec -it bitcoind bitcoin-cli getblockcount ``` +