Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonzoRicardo authored and fmfmartins committed Aug 27, 2020
1 parent a9a5957 commit 850b0dd
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ before_script:
env:
- VERSION=0.15/alpine
- VERSION=0.15
- VERSION=0.17/alpine
- VERSION=0.17

language: bash

Expand Down
51 changes: 51 additions & 0 deletions 0.17/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
124 changes: 124 additions & 0 deletions 0.17/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
26 changes: 26 additions & 0 deletions 0.17/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
26 changes: 26 additions & 0 deletions 0.17/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 850b0dd

Please sign in to comment.