diff --git a/.gitignore b/.gitignore index 59c923bbe..fea0169e0 100644 --- a/.gitignore +++ b/.gitignore @@ -141,4 +141,5 @@ contrib/devtools/split-debug.sh osx_volname dist/ -*.background.tiff \ No newline at end of file +*.background.tiff +.Trash* diff --git a/Jenkinsfile b/Jenkinsfile index 4930cbf43..84749c24f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,10 @@ pipeline { - agent { - dockerfile { - filename 'contrib/docker/moreBuilder/Dockerfile.ubase' + agent { label 'master' } + stages { + stage('build') { + steps { + sh "contrib/docker/build.sh -o aarch64-linux-gnu blackcoinnl github CoinBlack " + env.GIT_LOCAL_BRANCH + " Etc/UTC" + } + } } - - } - stages { - stage('Build') { - steps { - sh 'blackmored -daemon' - } - } - - } -} \ No newline at end of file +} diff --git a/contrib/docker/.gitignore b/contrib/docker/.gitignore new file mode 100644 index 000000000..d3bead3f1 --- /dev/null +++ b/contrib/docker/.gitignore @@ -0,0 +1,7 @@ +aarch64-linux-gnu/aarch64-linux-gnu/* +aarch64-linux-gnu/parts/* +arm-linux-gnueabihf/arm-linux-gnueabihf/* +arm-linux-gnueabihf/parts/* +x86_64-linux-gnu/x86_64-linux-gnu/* +x86_64-linux-gnu/parts/* +depends*.*xz \ No newline at end of file diff --git a/contrib/docker/moreBuilder/README.md b/contrib/docker/README.md similarity index 100% rename from contrib/docker/moreBuilder/README.md rename to contrib/docker/README.md diff --git a/contrib/docker/aarch64-linux-gnu/Dockerfile.ubase-aarch64-linux-gnu b/contrib/docker/aarch64-linux-gnu/Dockerfile.ubase-aarch64-linux-gnu new file mode 100644 index 000000000..f46f56db0 --- /dev/null +++ b/contrib/docker/aarch64-linux-gnu/Dockerfile.ubase-aarch64-linux-gnu @@ -0,0 +1,77 @@ +FROM ubuntu AS ubase-base-aarch64-linux-gnu +ARG BRANCH +ENV BRANCH=$BRANCH +ARG TIMEZONE +ENV TIMEZONE=$TZ +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 \ +# blk commandline utility + jq \ + bc \ +# cross compile arm + g++-arm-linux-gnueabihf \ + binutils-arm-linux-gnueabihf \ +# cross compile aarch64 + g++-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu \ +# cross compile macOS + curl \ + librsvg2-bin \ + libtiff-tools \ + bsdmainutils \ + cmake \ + imagemagick \ + libcap-dev \ + libz-dev \ + libbz2-dev \ + python3-setuptools \ + libtinfo5 + + +FROM ubase-base-aarch64-linux-gnu AS ubase-aarch64-linux-gnu + +RUN git clone -b $BRANCH https://github.com/CoinBlack/blackcoin-more.git + + +COPY aarch64-linux-gnu ./aarch64-linux-gnu +WORKDIR /blackcoin-more +RUN (git clean -xf && \ + ./autogen.sh && \ + ./configure --prefix=/aarch64-linux-gnu --enable-glibc-back-compat --enable-reduce-exports --disable-tests --disable-bench --disable-gui-tests --enable-upnp-default LDFLAGS=-static-libstdc++ && \ + make -j4 && \ + make install && \ + cd src/ && \ + /usr/bin/aarch64-linux-gnu-strip blackmore*) + +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 /aarch64-linux-gnu/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 ./ && \ + cp /usr/bin/jq --parents ./ +WORKDIR / +RUN ls /blackcoin-more/src | grep blackmore && ls /usr/local/bin && ls /aarch64-linux-gnu/parts/usr \ No newline at end of file diff --git a/contrib/docker/aarch64-linux-gnu/Dockerfile.ubuntu-aarch64-linux-gnu b/contrib/docker/aarch64-linux-gnu/Dockerfile.ubuntu-aarch64-linux-gnu new file mode 100644 index 000000000..104e75e3f --- /dev/null +++ b/contrib/docker/aarch64-linux-gnu/Dockerfile.ubuntu-aarch64-linux-gnu @@ -0,0 +1,22 @@ +FROM ubase-aarch64-linux-gnu AS ubuntu-aarch64-linux-gnu + +# 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 to our new container +COPY --from=ubase-aarch64-linux-gnu /blackcoin-more/src/blackmored /usr/local/bin +COPY --from=ubase-aarch64-linux-gnu /blackcoin-more/src/blackmore-cli /usr/local/bin +COPY --from=ubase-aarch64-linux-gnu /usr/bin/bc /usr/bin +COPY --from=ubase-aarch64-linux-gnu /usr/bin/jq /usr/bin + +# Expose the port for the RPC interface +EXPOSE 15714/tcp \ No newline at end of file diff --git a/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubase-arm-linux-gnueabihf b/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubase-arm-linux-gnueabihf new file mode 100644 index 000000000..0d552b450 --- /dev/null +++ b/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubase-arm-linux-gnueabihf @@ -0,0 +1,74 @@ +FROM ubuntu AS ubase-base-arm-linux-gnueabihf +ARG BRANCH +ENV BRANCH=$BRANCH +ARG TIMEZONE +ENV TIMEZONE=$TZ +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 \ +# blk commandline utility + jq \ + bc \ +# cross compile arm + g++-arm-linux-gnueabihf \ + binutils-arm-linux-gnueabihf \ +# cross compile aarch64 + g++-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu \ +# cross compile macOS + curl \ + librsvg2-bin \ + libtiff-tools \ + bsdmainutils \ + cmake \ + imagemagick \ + libcap-dev \ + libz-dev \ + libbz2-dev \ + python3-setuptools \ + libtinfo5 + +FROM ubase-base-arm-linux-gnueabihf AS ubase-arm-linux-gnueabihf + +RUN git clone -b $BRANCH https://github.com/CoinBlack/blackcoin-more.git + +COPY arm-linux-gnueabihf ./arm-linux-gnueabihf +WORKDIR /blackcoin-more +RUN (git clean -xf && \ + ./autogen.sh && \ + ./configure --prefix=/arm-linux-gnueabihf --enable-glibc-back-compat --enable-reduce-exports --disable-tests --disable-bench --disable-gui-tests --enable-upnp-default LDFLAGS=-static-libstdc++ && \ + make -j4 && \ + make install && \ + cd src/ && \ + /usr/bin/arm-linux-gnueabihf-strip blackmore*) + +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 /arm-linux-gnueabihf/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 ./ && \ + cp /usr/bin/jq --parents ./ +WORKDIR / \ No newline at end of file diff --git a/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubuntu-arm-linux-gnueabihf b/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubuntu-arm-linux-gnueabihf new file mode 100644 index 000000000..0f6ac205c --- /dev/null +++ b/contrib/docker/arm-linux-gnueabihf/Dockerfile.ubuntu-arm-linux-gnueabihf @@ -0,0 +1,22 @@ +FROM ubase-arm-linux-gnueabihf AS ubuntu-arm-linux-gnueabihf + +# 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 to our new container +COPY --from=ubase-arm-linux-gnueabihf /blackcoin-more/src/blackmored /usr/local/bin +COPY --from=ubase-arm-linux-gnueabihf /blackcoin-more/src/blackmore-cli /usr/local/bin +COPY --from=ubase-arm-linux-gnueabihf /usr/bin/bc /usr/bin +COPY --from=ubase-arm-linux-gnueabihf /usr/bin/jq /usr/bin + +# Expose the port for the RPC interface +EXPOSE 15714/tcp \ No newline at end of file diff --git a/contrib/docker/build.sh b/contrib/docker/build.sh new file mode 100755 index 000000000..95f816e06 --- /dev/null +++ b/contrib/docker/build.sh @@ -0,0 +1,185 @@ +#!/bin/bash +[[ -z `echo $PWD | grep jenkins_home` ]] && BASE_DIR=$(dirname $(realpath $0 )) || BASE_DIR="${WORKSPACE}/contrib/docker" +Alist="\n +\t \t \t \t aarch64-linux-gnu \t (eg. Raspi4 with Ubuntu) \n +\t \t \t \t arm-linux-gnueabihf \t (eg. Other Raspi) \n +\t \t \t \t x86_64-linux-gnu \t (aka. Linux AMD64) \n +\t \t \t \t all \t (only works in option mode) \n +" + +usage="Usage: \n +\t option mode: \t \`build.sh -o \` \n +\t interactive: \t \`build.sh -i\` \n +\t \t \t help: \t \`build.sh -h\` \n +\n Architectures: ${Alist} \n +" + +h1=" \t Choose your architecture. ${Alist}" +h2=" \t \t Enter your Docker Hub Account name." +h3=" \t \t \t Enter \"github\" or \"gitlab\"." +h4=" \t Enter the git account name. (eg. \"CoinBlack\" on GitHub, or \"blackcoin\" on GitLab)" +h5=" \t \t \t Enter the BRANCH name. (eg. master)" +h6=" \t \t Enter your timezone. (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)" + +help=" \n +\t The defaults in interactive mode, written in for option mode: \n +build.sh -o x86_64-linux-gnu blackcoinnl github CoinBlack v2.13.2.7 America/Los_Angeles \n +\n $h1 \n +\n $h2 \n +\n $h3 \n +\n $h4 \n +\n $h5 \n +\n $h6 \n +" + +case $1 in + +-h) + echo -e ${help} +;; + +-i|-o) + +# Questions for Interactive Mode + +defaultARCH=${2:-x86_64-linux-gnu} +defaultDockerHub=${3:-blackcoinnl} +defaultHubLab=${4:-github} +defaultRepo=${5:-CoinBlack} +defaultBranch=${6:-v2.13.2.7} +defaultTimezone=${7:-America/Los_Angeles} +if [[ $1 == -i ]]; then + echo -e ${Alist} + read -p "For what architecture would you like to build? ($defaultARCH): " architecture + read -p "What is your DockerHub Account Name? ($defaultDockerHub): " DockerHub + read -p "Github or Gitlab? ($defaultHubLab): " HubLab + read -p "What is your GitAccount name? ($defaultRepo): " GitAccount + read -p "What BRANCH/version? ($defaultBranch): " BRANCH + read -p "What is your TIMEZONE? (${defaultTimezone}): " TIMEZONE + echo "Architecture: ${architecture}" + echo "DockerHub Account: ${DockerHub}" + echo "Git Account: ${HubLab}.com/${GitAccount} ${BRANCH}" + echo "Timezone: ${TIMEZONE}" +else + echo -e " + Option Mode! \n + Architecture: $2 + DockerHub Account: $3 + Git Account: https://${4}.com/${5} ${6} + Timezone: ${7} + " +fi + +# Architecture + + +architecture=${architecture:-${defaultARCH}} +if [[ ${architecture} == all ]]; then + bash ${BASE_DIR}/build.sh -o aarch64-linux-gnu $3 $4 $5 $6 $7 + bash ${BASE_DIR}/build.sh -o arm-linux-gnueabihf $3 $4 $5 $6 $7 + bash ${BASE_DIR}/build.sh -o x86_64-linux-gnu $3 $4 $5 $6 $7 + exit 0 +else + [[ ${architecture} != ${defaultARCH} ]] && sed -i "s/-x86_64-linux-gnu/-${architecture}/" $0 + + # Download Dependencies + + if [[ -f ${BASE_DIR}/depends-${architecture}.tar.xz && -f ${BASE_DIR}/${architecture}/${architecture}/bin/fc-cache ]]; then + echo "Dependencies exist! Checking sha256sum!"; + + case $architecture in + aarch64-linux-gnu) + checkSUM=`echo "f6f1b099d876db90396d0d56eb5b3f366f14c90e077524e2b10bfdaaa1aa5805 ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK!" || exit 1 + ;; + arm-linux-gnueabihf) + checkSUM=`echo "339c1159adcccecb45155b316f1f5772009b92acb8cfed29464dd7f09775fb79 ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK!" || exit 1 + ;; + x86_64-linux-gnu) + checkSUM=`echo "eed063b26f4c4e0fa35dc085fe09bafd4251cffa76cdabb26bf43077da03b84e ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK!" || exit 1 + ;; + esac + else + [[ -z `which wget` ]] && apt-get install wget + /usr/bin/wget -qO ${BASE_DIR}/depends-${architecture}.tar.xz https://admin.blackcoin.nl/static/depends-${architecture}.tar.xz + + case $architecture in + aarch64-linux-gnu) + platform="linux/arm64, linux/arm/v8" + checkSUM=`echo "f6f1b099d876db90396d0d56eb5b3f366f14c90e077524e2b10bfdaaa1aa5805 ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK! You will need sudo to untar the dependencies." && sudo tar xJf ${BASE_DIR}/depends-${architecture}.tar.xz -C ${BASE_DIR}/\ + || exit 1 + ;; + arm-linux-gnueabihf) + platform="linux/arm/v7" + checkSUM=`echo "339c1159adcccecb45155b316f1f5772009b92acb8cfed29464dd7f09775fb79 ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK! You will need sudo to untar the dependencies." && sudo tar xJf ${BASE_DIR}/depends-${architecture}.tar.xz -C ${BASE_DIR}/\ + || exit 1 + ;; + x86_64-linux-gnu) + platform="linux/amd64" + checkSUM=`echo "eed063b26f4c4e0fa35dc085fe09bafd4251cffa76cdabb26bf43077da03b84e ${BASE_DIR}/depends-${architecture}.tar.xz" | sha256sum --check | awk '{print $2}' 2> /dev/null` + [[ "${checkSUM}" == "OK" ]] && echo "The sha256sum is OK! You will need sudo to untar the dependencies." && sudo tar xJf ${BASE_DIR}/depends-${architecture}.tar.xz -C ${BASE_DIR}/\ + || exit 1 + ;; + esac + echo -e " + Dependencies SHA256SUM GOOD! + " + fi + + + # DockerHub Account + + DockerHub=${DockerHub:-${defaultDockerHub}} + [[ $DockerHub != ${defaultDockerHub} ]] && sed -i "s/blackcoinnl/${DockerHub}/" $0 + + # Git Account + + HubLab=${HubLab:-${defaultHubLab}} + [[ $HubLab != $defaultHubLab ]] && sed -i "s|github|${HubLab}|" $0 + + GitAccount=${GitAccount:-${defaultRepo}} + [[ ${GitAccount} != ${defaultRepo} ]] && sed -i "s|CoinBlack|$GitAccount|" $0 + + # BRANCH + + BRANCH=${BRANCH:-${defaultBranch}} + [[ ${BRANCH} != ${defaultBranch} ]] && sed -i "s|v2.13.2.7|${BRANCH}|" $0 + + # TIMEZONE + + TIMEZONE=${TIMEZONE:-${defaultTimezone}} + [[ ${TIMEZONE} != ${defaultTimezone} ]] && sed -i "s|America/Los_Angeles|${TIMEZONE}|" $0 + + # build ubase + ubase="ubase-${architecture}" + Dockerfile="${BASE_DIR}/${architecture}/Dockerfile.${ubase}" + docker build --network=host ${BASE_DIR}/${architecture} -t ${ubase} --build-arg BRANCH=${BRANCH} --build-arg TIMEZONE=${TZ} -f ${Dockerfile} + + # build ubuntu + ubuntu="ubuntu-${architecture}" + Dockerfile="${BASE_DIR}/${architecture}/Dockerfile.${ubuntu}" + docker build --network=host -t ${ubuntu}:${BRANCH} - < ${Dockerfile} + [[ ${BRANCH} != master ]] || docker image tag ${ubuntu}:${BRANCH} ${DockerHub}/blackcoin-more-ubuntu-${architecture}:latest && \ + docker image tag ${ubuntu}:${BRANCH} ${DockerHub}/blackcoin-more-ubuntu-${architecture}:${BRANCH} + + # build minimal + minimal="minimal-${architecture}" + rm -fr ${BASE_DIR}/${architecture}/parts + docker run -itd --network=host --name ${ubase} ${ubase} bash + docker cp ${ubase}:/${architecture}/parts ${BASE_DIR}/${architecture}/parts + cd ${BASE_DIR}/${architecture} + tar -C parts -c . | docker import - ${minimal}:${BRANCH} + docker container rm -f ${ubase} + [[ ${BRANCH} != master ]] || docker image tag ${minimal}:${BRANCH} ${DockerHub}/blackcoin-more-minimal-${architecture}:latest && \ + docker image tag ${minimal}:${BRANCH} ${DockerHub}/blackcoin-more-minimal-${architecture}:${BRANCH} + +fi +;; +*) +echo -e ${usage} +;; +esac \ No newline at end of file diff --git a/contrib/docker/moreBuilder/Dockerfile.ubuntu b/contrib/docker/moreBuilder/Dockerfile.ubuntu deleted file mode 100755 index 29a948104..000000000 --- a/contrib/docker/moreBuilder/Dockerfile.ubuntu +++ /dev/null @@ -1,32 +0,0 @@ -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/build.sh b/contrib/docker/moreBuilder/build.sh deleted file mode 100755 index 9a0c7db79..000000000 --- a/contrib/docker/moreBuilder/build.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/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 diff --git a/contrib/docker/moreBuilder/Dockerfile.ubase b/contrib/docker/x86_64-linux-gnu/Dockerfile.ubase-x86_64-linux-gnu old mode 100755 new mode 100644 similarity index 54% rename from contrib/docker/moreBuilder/Dockerfile.ubase rename to contrib/docker/x86_64-linux-gnu/Dockerfile.ubase-x86_64-linux-gnu index 77e40f611..2421bc3e5 --- a/contrib/docker/moreBuilder/Dockerfile.ubase +++ b/contrib/docker/x86_64-linux-gnu/Dockerfile.ubase-x86_64-linux-gnu @@ -1,6 +1,8 @@ -FROM ubuntu -ENV BRANCH=master -ENV TZ=America/Los_Angeles +FROM ubuntu AS ubase-base-x86_64-linux-gnu +ARG BRANCH +ENV BRANCH=$BRANCH +ARG TIMEZONE +ENV TIMEZONE=$TZ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update && apt-get install -yqq \ git \ @@ -22,44 +24,51 @@ RUN apt-get update && apt-get install -yqq \ libssl-dev \ gperf \ wget \ +# blk commandline utility jq \ - bc + bc \ +# cross compile arm + g++-arm-linux-gnueabihf \ + binutils-arm-linux-gnueabihf \ +# cross compile aarch64 + g++-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu \ +# cross compile macOS + curl \ + librsvg2-bin \ + libtiff-tools \ + bsdmainutils \ + cmake \ + imagemagick \ + libcap-dev \ + libz-dev \ + libbz2-dev \ + python3-setuptools \ + libtinfo5 -# -# Build Blackcoin More -# +FROM ubase-base-x86_64-linux-gnu AS ubase-x86_64-linux-gnu -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 && \ +RUN git clone -b $BRANCH https://github.com/CoinBlack/blackcoin-more.git + +COPY x86_64-linux-gnu ./x86_64-linux-gnu +WORKDIR /blackcoin-more +RUN (git clean -xf && \ + ./autogen.sh && \ + ./configure --prefix=/x86_64-linux-gnu --enable-glibc-back-compat --enable-reduce-exports --disable-tests --disable-bench --disable-gui-tests --enable-upnp-default LDFLAGS=-static-libstdc++ && \ + make -j4 && \ 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 -# + /usr/bin/strip blackmore*) 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 - +WORKDIR /x86_64-linux-gnu/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 + cp /usr/bin/jq --parents ./ +WORKDIR / \ No newline at end of file diff --git a/contrib/docker/x86_64-linux-gnu/Dockerfile.ubuntu-x86_64-linux-gnu b/contrib/docker/x86_64-linux-gnu/Dockerfile.ubuntu-x86_64-linux-gnu new file mode 100644 index 000000000..7274df2dd --- /dev/null +++ b/contrib/docker/x86_64-linux-gnu/Dockerfile.ubuntu-x86_64-linux-gnu @@ -0,0 +1,23 @@ +FROM ubase-x86_64-linux-gnu AS ubuntu-x86_64-linux-gnu + +# 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 to our new container +COPY --from=ubase-x86_64-linux-gnu /blackcoin-more/src/blackmored /usr/local/bin +COPY --from=ubase-x86_64-linux-gnu /blackcoin-more/src/blackmore-cli /usr/local/bin +COPY --from=ubase-x86_64-linux-gnu /usr/bin/bc /usr/bin +COPY --from=ubase-x86_64-linux-gnu /usr/bin/jq /usr/bin + +# Expose the port for the RPC interface + +EXPOSE 15714/tcp \ No newline at end of file