diff --git a/.travis.yml b/.travis.yml index bc93046..8869fa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ before_script: env: - VERSION=0.15/alpine - VERSION=0.15 + - VERSION=0.17/alpine + - VERSION=0.17 language: bash diff --git a/0.17/Dockerfile b/0.17/Dockerfile new file mode 100644 index 0000000..a525efd --- /dev/null +++ b/0.17/Dockerfile @@ -0,0 +1,51 @@ +FROM debian:stable-slim + +LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \ + maintainer.1="Pedro Branco (@pedrobranco)" \ + maintainer.2="Rui Marinho (@ruimarinho)" + +RUN useradd -r bitcoingold \ + && apt-get update -y \ + && apt-get install -y curl gnupg unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && set -ex \ + && for key in \ + B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + 38EE12EB597B4FC0 \ + ; 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 GOSU_VERSION=1.10 + +RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture) \ + && curl -o /usr/local/bin/gosu.asc -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture).asc \ + && gpg --verify /usr/local/bin/gosu.asc \ + && rm /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu + +ENV BITCOIN_GOLD_VERSION=0.17.3 +ENV BITCOIN_GOLD_FOLDER_VERSION=0.17.3 +ENV BITCOIN_GOLD_PREFIX=/opt/bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION} +ENV BITCOIN_GOLD_DATA=/home/bitcoingold/.bitcoingold +ENV PATH=${BITCOIN_GOLD_PREFIX}/bin:$PATH +RUN curl -SLO https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}-x86_64-linux-gnu.tar.gz \ + && curl -SLO https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/SHA256SUMS.asc \ + && gpg --verify SHA256SUMS.asc \ + && grep " bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}-x86_64-linux-gnu.tar.gz\$" SHA256SUMS.asc | sha256sum -c - \ + && tar -xzf *.tar.gz -C /opt \ + && rm *.tar.gz + +COPY docker-entrypoint.sh /entrypoint.sh + +VOLUME ["/home/bitcoingold/.bitcoingold"] + +EXPOSE 8332 8338 18332 18338 18444 + +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["bgoldd"] diff --git a/0.17/alpine/Dockerfile b/0.17/alpine/Dockerfile new file mode 100644 index 0000000..f0753a0 --- /dev/null +++ b/0.17/alpine/Dockerfile @@ -0,0 +1,124 @@ +# Build stage for BerkeleyDB +FROM alpine:3.9 as berkeleydb + +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 Gold +FROM alpine:3.9 as bitcoin-gold + +COPY --from=berkeleydb /opt /opt + +RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /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 libsodium-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 apk --no-cache add libb2-dev +RUN set -ex \ + && for key in \ + 38EE12EB597B4FC0 \ + ; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ + gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done + +ENV BITCOIN_GOLD_VERSION=0.17.3 +ENV BITCOIN_GOLD_FOLDER_VERSION=0.17.3 +ENV BITCOIN_GOLD_PREFIX=/opt/bitcoin-gold-${BITCOIN_GOLD_VERSION} + +RUN wget https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}.tar.gz +RUN wget https://github.com/BTCGPU/BTCGPU/releases/download/v${BITCOIN_GOLD_VERSION}/SHA256SUMS.asc +RUN gpg --verify SHA256SUMS.asc +RUN grep " bitcoin-gold-${BITCOIN_GOLD_FOLDER_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - +RUN tar -xzf *.tar.gz + +WORKDIR /bitcoin-gold-${BITCOIN_GOLD_FOLDER_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 --verbose LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ + --prefix=${BITCOIN_GOLD_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_GOLD_PREFIX}/bin/bgold-cli +RUN strip ${BITCOIN_GOLD_PREFIX}/bin/bitcoin-tx +RUN strip ${BITCOIN_GOLD_PREFIX}/bin/bgoldd +RUN strip ${BITCOIN_GOLD_PREFIX}/lib/libbitcoinconsensus.a +RUN strip ${BITCOIN_GOLD_PREFIX}/lib/libbitcoinconsensus.so.0.0.0 + +# Build stage for compiled artifacts +FROM alpine:3.9 + +LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \ + maintainer.1="Pedro Branco (@pedrobranco)" \ + maintainer.2="Rui Marinho (@ruimarinho)" + +RUN adduser -S bitcoingold + +RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories +RUN apk --no-cache add \ + boost \ + boost-program_options \ + curl \ + libevent \ + libressl \ + libzmq \ + libb2-dev \ + su-exec + +ENV BITCOIN_GOLD_DATA=/home/bitcoingold/.bitcoingold +ENV BITCOIN_GOLD_VERSION=0.17.3 +ENV BITCOIN_GOLD_PREFIX=/opt/bitcoin-gold-${BITCOIN_GOLD_VERSION} +ENV PATH=${BITCOIN_GOLD_PREFIX}/bin:$PATH + +COPY --from=bitcoin-gold /opt /opt +COPY docker-entrypoint.sh /entrypoint.sh + +VOLUME ["/home/bitcoingold/.bitcoingold"] + +EXPOSE 8332 8338 18332 18338 18444 + +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["bgoldd"] diff --git a/0.17/alpine/docker-entrypoint.sh b/0.17/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..216bcf0 --- /dev/null +++ b/0.17/alpine/docker-entrypoint.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for bgoldd" + + set -- bgoldd "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "bgoldd" ]; then + mkdir -p "$BITCOIN_GOLD_DATA" + chmod 700 "$BITCOIN_GOLD_DATA" + chown -R bitcoingold "$BITCOIN_GOLD_DATA" + + echo "$0: setting data directory to $BITCOIN_GOLD_DATA" + + set -- "$@" -datadir="$BITCOIN_GOLD_DATA" +fi + +if [ "$1" = "bgoldd" ] || [ "$1" = "bgold-cli" ] || [ "$1" = "bitcoin-tx" ]; then + echo + exec su-exec bitcoingold "$@" +fi + +echo +exec "$@" diff --git a/0.17/docker-entrypoint.sh b/0.17/docker-entrypoint.sh new file mode 100755 index 0000000..00348ec --- /dev/null +++ b/0.17/docker-entrypoint.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for bgoldd" + + set -- bgoldd "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "bgoldd" ]; then + mkdir -p "$BITCOIN_GOLD_DATA" + chmod 700 "$BITCOIN_GOLD_DATA" + chown -R bitcoingold "$BITCOIN_GOLD_DATA" + + echo "$0: setting data directory to $BITCOIN_GOLD_DATA" + + set -- "$@" -datadir="$BITCOIN_GOLD_DATA" +fi + +if [ "$1" = "bgoldd" ] || [ "$1" = "bgold-cli" ] || [ "$1" = "bitcoin-tx" ]; then + echo + exec gosu bitcoingold "$@" +fi + +echo +exec "$@" diff --git a/README.md b/README.md index abfc966..c16ad41 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ A Bitcoin Gold docker image. ## Tags +- `0.17.3-alpine`, `0.17-alpine`, `alpine`, `latest` ([0.17/alpine/Dockerfile](https://github.com/uphold/docker-bitcoin-gold/blob/master/0.17/alpine/Dockerfile)) +- `0.17.3`, `0.17` ([0.17/Dockerfile](https://github.com/uphold/docker-bitcoin-gold/blob/master/0.17/Dockerfile)) - `0.15.2-alpine`, `0.15-alpine`, `alpine`, `latest` ([0.15/alpine/Dockerfile](https://github.com/uphold/docker-bitcoin-gold/blob/master/0.15/alpine/Dockerfile)) - `0.15.2`, `0.15` ([0.15/Dockerfile](https://github.com/uphold/docker-bitcoin-gold/blob/master/0.15/Dockerfile))