diff --git a/contrib/docker/moreBuilder/Dockerfile.ubase b/contrib/docker/moreBuilder/Dockerfile.ubase new file mode 100755 index 000000000..77e40f611 --- /dev/null +++ b/contrib/docker/moreBuilder/Dockerfile.ubase @@ -0,0 +1,65 @@ +FROM ubuntu +ENV BRANCH=master +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get update && apt-get install -yqq \ + git \ + make \ + file \ + autoconf \ + automake \ + libtool \ + libevent-dev \ + build-essential \ + autotools-dev \ + pkg-config \ + bsdmainutils \ + python3 \ + libevent-dev \ + libboost-all-dev \ + libminiupnpc-dev \ + libzmq3-dev \ + libssl-dev \ + gperf \ + wget \ + jq \ + bc + +# +# Build Blackcoin More +# + +RUN git clone -b $BRANCH https://github.com/CoinBlack/blackcoin-more.git +RUN (wget http://distfiles.gentoo.org/distfiles/db-6.2.38.tar.gz && \ + tar -xvf db-6.2.38.tar.gz && \ + cd db-6.2.38/build_unix && \ + mkdir -p build && \ + BDB_PREFIX=$(pwd)/build && \ + ../dist/configure --disable-shared -disable-replication --enable-cxx --with-pic --prefix=$BDB_PREFIX --with-gui=no --enable-glibc-back-compat --enable-reduce-exports --disable-tests --disable-bench --disable-gui-tests --disable-man && \ + make install && \ + cd ../.. && \ + cd blackcoin-more/ && ./autogen.sh && \ + ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --disable-tests --disable-bench --enable-reduce-exports && \ + make -j4 && \ + cd src/ && \ + strip blackmore*) + +# +# Prepare for minimal package +# + +RUN cp /blackcoin-more/src/blackmored /usr/local/bin/ && \ + cp /blackcoin-more/src/blackmore-cli /usr/local/bin/ && \ + cp /blackcoin-more/contrib/blk /usr/local/bin/ + +WORKDIR /parts + +RUN cp --parents /usr/local/bin/blk ./ && \ + cp --parents /usr/local/bin/blackmored ./ && \ + for i in `ldd /usr/local/bin/blackmored | grep -v linux-vdso.so.1 | awk {' if ( $3 == "") print $1; else print $3 '}`; do cp --parents $i ./; done && \ + cp --parents /usr/local/bin/blackmore-cli ./ && \ + for i in `ldd /usr/local/bin/blackmore-cli | grep -v linux-vdso.so.1 | awk {' if ( $3 == "") print $1; else print $3 '}`; do cp --parents $i ./; done && \ + cp /usr/bin/bc --parents ./ && \ + for i in `ldd /usr/bin/bc | grep -v linux-vdso.so.1 | awk {' if ( $3 == "") print $1; else print $3 '}`; do cp --parents $i ./; done && \ + cp /usr/bin/jq --parents ./ && \ + for i in `ldd /usr/bin/jq | grep -v linux-vdso.so.1 | grep -v libjq.so.1 | awk {' if ( $3 == "") print $1; else print $3 '}`; do cp --parents $i ./; done diff --git a/contrib/docker/moreBuilder/Dockerfile.ubuntu b/contrib/docker/moreBuilder/Dockerfile.ubuntu new file mode 100755 index 000000000..29a948104 --- /dev/null +++ b/contrib/docker/moreBuilder/Dockerfile.ubuntu @@ -0,0 +1,32 @@ +FROM blackcoinnl/blackmore-ubase-x86_64:master as build + +RUN echo "Building Ubuntu Package" + +# +# Collect dependencies +# + +FROM ubuntu +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get update && \ + apt-get -yqq upgrade && \ + apt-get -yqq install \ + libboost-all-dev \ + libzmq3-dev \ + libminiupnpc-dev + +# +# Copy the binaries from the build to our new container +# +COPY --from=build /blackcoin-more/src/blackmored /usr/local/bin +COPY --from=build /blackcoin-more/src/blackmore-cli /usr/local/bin +COPY --from=build /usr/bin/bc /usr/bin +COPY --from=build /usr/bin/jq /usr/bin + + +# +# Expose the port for the RPC interface +# + +EXPOSE 15714/tcp diff --git a/contrib/docker/moreBuilder/README.md b/contrib/docker/moreBuilder/README.md new file mode 100755 index 000000000..09c603f08 --- /dev/null +++ b/contrib/docker/moreBuilder/README.md @@ -0,0 +1,10 @@ +## To Build + +#### Log in to [Docker Hub](https://hub.docker.com). + +`docker login` + +#### Build + +`moreBuilder/build.sh` + diff --git a/contrib/docker/moreBuilder/build.sh b/contrib/docker/moreBuilder/build.sh new file mode 100755 index 000000000..9a0c7db79 --- /dev/null +++ b/contrib/docker/moreBuilder/build.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +BASE_DIR=$(dirname $(realpath $0 )) +moreBuilder=${BASE_DIR}/moreBuilder +SYSTYPE=`lscpu | head -1 | tr -s ' ' | cut -d ' ' -f2` + +# DockerHub Account + +defaultDockerHub=blackcoinnl +read -p "What is your DockerHub Account Name? (default $defaultDockerHub): " DockerHub +DockerHub=${DockerHub:-${defaultDockerHub}} +if [ $DockerHub != $defaultDockerHub ]; then + sed -i "s/defaultDockerHub=blackcoinnl/defaultDockerHub=$DockerHub/" $0 +fi + +# Git Account + +defaultHubLab=github +read -p "Github or Gitlab? (default $defaultHubLab): " HubLab +HubLab=${HubLab:-${defaultHubLab}} +if [ $HubLab != $defaultHubLab ]; then + sed -i "s|defaultHubLab=github|defaultGit=$HubLab|" $0 + sed -i "s|github|$HubLab|" ${BASE_DIR}/Dockerfile.ubase +fi + +defaultGit=CoinBlack +read -p "What is your Git account? (default $defaultGit): " Git +Git=${Git:-${defaultGit}} +if [ $Git != $defaultGit ]; then + sed -i "s|defaultGit=CoinBlack|defaultGit=$Git|" $0 + sed -i "s|CoinBlack|$Git|" ${BASE_DIR}/Dockerfile.ubase +fi + +# Git Branch + +read -p "What branch/version? (default $defaultBranch): " BRANCH +defaultBranch=master +BRANCH=${BRANCH:-${defaultBranch}} +if [ $BRANCH != $defaultBranch ]; then + sed -i "s|defaultBranch=master|defaultBranch=$BRANCH|" $0 + sed -i "s|ENV BRANCH=v2.13.2.7|ENV BRANCH=$BRANCH|" ${BASE_DIR}/Dockerfile.ubase +fi + +# change branch for multi-stage build +defaultUbase=blackcoinnl/blackmore-ubase-x86_64:master +ubase="${DockerHub}/blackmore-ubase-$SYSTYPE:$BRANCH" +if [ $defaultUbase != $ubase ]; then + sed -i "s|FROM $defaultUbase as build|FROM $ubase as build|" ${BASE_DIR}/Dockerfile.ubuntu + sed -i "s|defaultUbase=blackcoinnl/blackmore-ubase-x86_64:master|defaultUbase=$ubase|" $0 +fi + +# timezone +defaultTimezone=America/Los_Angeles +read -p "What is your timezone? (default $defaultTimezone): " timezone +timezone=${timezone:-${defaultTimezone}} +if [ $timezone != $defaultTimezone ]; then + sed -i "s|defaultTimezone=America/Los_Angeles|defaultTimezone=$timezone|" $0 + sed -i "s|defaultTimezone=America/Los_Angeles|$timezone|" ${BASE_DIR}/Dockerfile.ubase + sed -i "s|defaultTimezone=America/Los_Angeles|$timezone|" ${BASE_DIR}/Dockerfile.ubuntu +fi + + +echo "DockerHub Account: ${DockerHub}" +echo "Git Account: $Git" +echo $BRANCH +echo $SYSTYPE +echo $timezone + + + + +minimal="${DockerHub}/blackcoin-more-minimal-$SYSTYPE:$BRANCH" +ubuntu="${DockerHub}/blackcoin-more-ubuntu-$SYSTYPE:$BRANCH" +ubase="${DockerHub}/blackmore-ubase-$SYSTYPE:$BRANCH" + +# build + +docker build -t $ubase - --network=host < ${BASE_DIR}/Dockerfile.ubase + +docker run -itd --network=host --name ubase $ubase bash + +docker cp ubase:/parts $moreBuilder +cd $moreBuilder +tar -C parts -c . | docker import - $minimal + +docker container rm -f ubase + +# push to docker hub + +docker image push $minimal +docker image push $ubuntu \ No newline at end of file