From b7d29eaf45ea0d4d9de1d4e5306e2734e112075d Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 20 Nov 2020 15:11:26 -0800 Subject: [PATCH 1/4] Update to 0.16.1.1 --- 0.16/Dockerfile | 44 +++++++++ 0.16/alpine/Dockerfile | 147 +++++++++++++++++++++++++++++++ 0.16/alpine/docker-entrypoint.sh | 26 ++++++ 0.16/docker-entrypoint.sh | 26 ++++++ README.md | 4 +- 5 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 0.16/Dockerfile create mode 100644 0.16/alpine/Dockerfile create mode 100755 0.16/alpine/docker-entrypoint.sh create mode 100755 0.16/docker-entrypoint.sh diff --git a/0.16/Dockerfile b/0.16/Dockerfile new file mode 100644 index 0000000..88f7bb9 --- /dev/null +++ b/0.16/Dockerfile @@ -0,0 +1,44 @@ +FROM debian:stable-slim + +LABEL maintainer.0="Jeff Hodges (@jhodges10)" \ + maintainer.1="Samuel Prado (@skateonrails)" + +RUN useradd -r dash \ + && apt-get update -y \ + && apt-get install -y curl gnupg unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + # Adding gpg for Dash files + && curl https://keybase.io/udjinm6/pgp_keys.asc | gpg --import \ + && curl https://keybase.io/nmarley/pgp_keys.asc | gpg --import \ + # Adding gpg for gosu + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 + +ENV GOSU_VERSION=1.11 + +RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }') \ + && curl -o /usr/local/bin/gosu.asc -fSL https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }').asc \ + && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && rm /usr/local/bin/gosu.asc \ + && chmod +x /usr/local/bin/gosu + +ENV DASH_VERSION=0.16.1.1 +ENV DASH_FOLDER_VERSION=0.16.0 +ENV DASH_SHASUM="8803928bd18e9515f1254f97751eb6e537a084d66111ce7968eafb23e26bf3a5 dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz" +ENV DASH_DATA=/home/dash/.dashcore \ + PATH=/opt/dashcore-${DASH_FOLDER_VERSION}/bin:$PATH + +RUN curl -SLO https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz \ + && echo "${DASH_SHASUM}" | sha256sum -c \ + && tar -xzf dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz -C /opt \ + && rm *.tar.gz + +VOLUME ["/home/dash/.dashcore"] + +COPY docker-entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 9998 9999 18332 19998 19999 + +CMD ["dashd"] diff --git a/0.16/alpine/Dockerfile b/0.16/alpine/Dockerfile new file mode 100644 index 0000000..67ad1e1 --- /dev/null +++ b/0.16/alpine/Dockerfile @@ -0,0 +1,147 @@ +# Build stage for BerkeleyDB +FROM alpine 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 + +FROM alpine as chiabls + +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 +RUN apk --no-cache add git +RUN apk --no-cache add cmake +RUN apk --no-cache add python3-dev + +ENV CHIA_BLS_PREFIX=/opt/chiabls + +RUN set -x \ + && git clone https://github.com/codablock/bls-signatures.git bls-signatures \ + && cd bls-signatures \ + && git fetch origin \ + && git checkout dash \ + && git submodule update --init --recursive \ + && mkdir build \ + && cd build \ + && cmake -DCMAKE_INSTALL_PREFIX:PATH=${CHIA_BLS_PREFIX} \ + -DCMAKE_PREFIX_PATH=${CHIA_BLS_PREFIX} \ + -DSTLIB=ON -DSHLIB=OFF -DSTBIN=ON \ + -DCMAKE_BUILD_TYPE=DEBUG \ + -DDEBUG=ON \ + -DOPSYS=LINUX -DCMAKE_SYSTEM_NAME=Linux -DWSIZE=64 \ + -DCMAKE_C_FLAGS_DEBUG="-g -O1" \ + .. \ + && cmake --build . --target install --config Release -- -j6 + +RUN ls -la ${CHIA_BLS_PREFIX} + +# Build stage for Dash +FROM alpine as dash + +COPY --from=berkeleydb /opt /opt +COPY --from=chiabls /opt /opt + +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 gmp gmp-dev +RUN apk --no-cache add libexecinfo-dev + +ENV DASH_VERSION=0.16.1.1 +ENV DASH_PREFIX=/opt/dash-${DASH_VERSION} +ENV DASH_SHASUM="8803928bd18e9515f1254f97751eb6e537a084d66111ce7968eafb23e26bf3a5 v${DASH_VERSION}.tar.gz" + +RUN wget https://github.com/dashpay/dash/archive/v${DASH_VERSION}.tar.gz +RUN echo "${DASH_SHASUM}" | sha256sum -c +RUN tar -xzf *.tar.gz +RUN ls -la +RUN ls -la /opt/chiabls/lib/.* + +WORKDIR /dash-${DASH_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 CFLAGS="-g -O1" \ + LDFLAGS="-L/opt/db-4.8.30.NC/lib/ -L/opt/chiabls/lib/" \ + CPPFLAGS="-I/opt/db-4.8.30.NC/include/ -I/opt/chiabls/include/ -I/opt/chiabls/include/relic/" \ + CXXFLAGS="-g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter" \ + --prefix=${DASH_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 ${DASH_PREFIX}/bin/dash-cli +RUN strip ${DASH_PREFIX}/bin/dash-tx +RUN strip ${DASH_PREFIX}/bin/dashd +RUN strip ${DASH_PREFIX}/lib/libdashconsensus.a +RUN strip ${DASH_PREFIX}/lib/libdashconsensus.so.0.0.0 + +# Build stage for compiled artifacts +FROM alpine + +LABEL maintainer.0="Jeff Hodges (@jhodges10)" \ + maintainer.1="Samuel Prado (@skateonrails)" + +RUN adduser -S dash +RUN apk --no-cache add \ + boost \ + boost-program_options \ + curl \ + libevent \ + libressl \ + libzmq \ + su-exec + +ENV DASH_DATA=/home/dash/.dashcore +ENV DASH_VERSION=0.16.1.1 +ENV DASH_PREFIX=/opt/dash-${DASH_VERSION} +ENV PATH=${DASH_PREFIX}/bin:$PATH + +COPY --from=dash /opt /opt +COPY docker-entrypoint.sh /entrypoint.sh + +VOLUME ["/home/dash/.dashcore"] + +EXPOSE 9998 9999 18332 19998 19999 + +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["dashd"] diff --git a/0.16/alpine/docker-entrypoint.sh b/0.16/alpine/docker-entrypoint.sh new file mode 100755 index 0000000..f88a7b7 --- /dev/null +++ b/0.16/alpine/docker-entrypoint.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for dashd" + + set -- dashd "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "dashd" ]; then + mkdir -p "$DASH_DATA" + chmod 700 "$DASH_DATA" + chown -R dash "$DASH_DATA" + + echo "$0: setting data directory to $DASH_DATA" + + set -- "$@" -datadir="$DASH_DATA" +fi + +if [ "$1" = "dashd" ] || [ "$1" = "dash-cli" ] || [ "$1" = "dash-tx" ]; then + echo + exec su-exec dash "$@" +fi + +echo +exec "$@" diff --git a/0.16/docker-entrypoint.sh b/0.16/docker-entrypoint.sh new file mode 100755 index 0000000..8ef60ac --- /dev/null +++ b/0.16/docker-entrypoint.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +if [ $(echo "$1" | cut -c1) = "-" ]; then + echo "$0: assuming arguments for dashd" + + set -- dashd "$@" +fi + +if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "dashd" ]; then + mkdir -p "$DASH_DATA" + chmod 700 "$DASH_DATA" + chown -R dash "$DASH_DATA" + + echo "$0: setting data directory to $DASH_DATA" + + set -- "$@" -datadir="$DASH_DATA" +fi + +if [ "$1" = "dashd" ] || [ "$1" = "dash-cli" ] || [ "$1" = "dash-tx" ]; then + echo + exec gosu dash "$@" +fi + +echo +exec "$@" diff --git a/README.md b/README.md index 11c91ee..c79ac02 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ A Dash Core docker image. ## Tags -- `0.14.0.5-alpine`, `0.14-alpine` ([0.14/alpine/Dockerfile](https://github.com/MindhiveCode/docker-dash-core/blob/master/0.14/alpine/Dockerfile)) -- `0.14.0.5`, `0.14` ([0.14/Dockerfile](https://github.com/MindhiveCode/docker-dash-core/blob/master/0.14/Dockerfile)) +- `0.16.1.1-alpine`, `0.16-alpine` ([0.14/alpine/Dockerfile](https://github.com/MindhiveCode/docker-dash-core/blob/master/0.14/alpine/Dockerfile)) +- `0.16.1.1`, `0.16` ([0.14/Dockerfile](https://github.com/MindhiveCode/docker-dash-core/blob/master/0.14/Dockerfile)) ## What is Dash? _from [dashwiki](https://github.com/dashpay/dash/wiki)_ From 59853dcacea7b1663c7f8d2543023385a93f2c02 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 20 Nov 2020 15:15:40 -0800 Subject: [PATCH 2/4] Fix travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5917f9..b12ada8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ services: docker matrix: include: - - env: VERSION=0.14.0.5 BUILD_PATH=0.14 - - env: VERSION=0.14.0.5 BUILD_PATH=0.14/alpine + - env: VERSION=0.16.1.1 BUILD_PATH=0.16 + - env: VERSION=0.16.1.1 BUILD_PATH=0.16/alpine branches: only: From 105aeb943c3925c6d5a39fcba83fa58ef9ffd1e4 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 20 Nov 2020 15:29:23 -0800 Subject: [PATCH 3/4] Fix checksum --- 0.16/Dockerfile | 2 +- 0.16/alpine/Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/0.16/Dockerfile b/0.16/Dockerfile index 88f7bb9..3e9f82c 100644 --- a/0.16/Dockerfile +++ b/0.16/Dockerfile @@ -24,7 +24,7 @@ RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/dow ENV DASH_VERSION=0.16.1.1 ENV DASH_FOLDER_VERSION=0.16.0 -ENV DASH_SHASUM="8803928bd18e9515f1254f97751eb6e537a084d66111ce7968eafb23e26bf3a5 dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz" +ENV DASH_SHASUM="98bc0f50c65ca1a149c95f1b87ae926457e0e0623af7a1e2a7e345fdfe0eecc8 dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz" ENV DASH_DATA=/home/dash/.dashcore \ PATH=/opt/dashcore-${DASH_FOLDER_VERSION}/bin:$PATH diff --git a/0.16/alpine/Dockerfile b/0.16/alpine/Dockerfile index 67ad1e1..542003a 100644 --- a/0.16/alpine/Dockerfile +++ b/0.16/alpine/Dockerfile @@ -79,9 +79,10 @@ RUN apk --no-cache add libexecinfo-dev ENV DASH_VERSION=0.16.1.1 ENV DASH_PREFIX=/opt/dash-${DASH_VERSION} -ENV DASH_SHASUM="8803928bd18e9515f1254f97751eb6e537a084d66111ce7968eafb23e26bf3a5 v${DASH_VERSION}.tar.gz" +ENV DASH_SHASUM="98bc0f50c65ca1a149c95f1b87ae926457e0e0623af7a1e2a7e345fdfe0eecc8 v${DASH_VERSION}.tar.gz" RUN wget https://github.com/dashpay/dash/archive/v${DASH_VERSION}.tar.gz +RUN echo "${DASH_SHASUM}" RUN echo "${DASH_SHASUM}" | sha256sum -c RUN tar -xzf *.tar.gz RUN ls -la From fdc669374f87d2d0a4be6475fc5bb32e4e92b190 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 20 Nov 2020 15:35:11 -0800 Subject: [PATCH 4/4] Fix checksums again --- 0.16/Dockerfile | 2 +- HowTo.md | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 HowTo.md diff --git a/0.16/Dockerfile b/0.16/Dockerfile index 3e9f82c..88f7bb9 100644 --- a/0.16/Dockerfile +++ b/0.16/Dockerfile @@ -24,7 +24,7 @@ RUN curl -o /usr/local/bin/gosu -fSL https://github.com/tianon/gosu/releases/dow ENV DASH_VERSION=0.16.1.1 ENV DASH_FOLDER_VERSION=0.16.0 -ENV DASH_SHASUM="98bc0f50c65ca1a149c95f1b87ae926457e0e0623af7a1e2a7e345fdfe0eecc8 dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz" +ENV DASH_SHASUM="8803928bd18e9515f1254f97751eb6e537a084d66111ce7968eafb23e26bf3a5 dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz" ENV DASH_DATA=/home/dash/.dashcore \ PATH=/opt/dashcore-${DASH_FOLDER_VERSION}/bin:$PATH diff --git a/HowTo.md b/HowTo.md new file mode 100644 index 0000000..7638b2c --- /dev/null +++ b/HowTo.md @@ -0,0 +1,15 @@ +# Making a new release + +1. Duplicate version folder +2. Update the DASH_CORE version in all the right places +3. Calculate the hash for the latest version by modifying the below link, downloading the file, and then dropping the zip file into this sha256 generator +> https://codeload.github.com/dashpay/dash/archive/v0.16.1.1.tar.gz + +> https://emn178.github.io/online-tools/sha256_checksum.html + +4. Testing locally, you'll run: + +``` + VERSION=0.16.1.1 BUILD_PATH=0.16 + VERSION=0.16.1.1 BUILD_PATH=0.16/alpine +``` \ No newline at end of file