From 463c8c90803fa139f3213d6b86e411d8406ae43c Mon Sep 17 00:00:00 2001 From: homdx <37062532+homdx@users.noreply.github.com> Date: Wed, 20 Jun 2018 16:55:18 +0300 Subject: [PATCH 1/7] Create Dockerfile Added Dockerfile --- Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..1cd93f27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +#Use Fedora 28 docker image +FROM fedora + +RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel && dnf clean all + +WORKDIR /app + +## Boost +ARG BOOST_VERSION=1_67_0 +ARG BOOST_VERSION_DOT=1.67.0 +ARG BOOST_HASH=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba +RUN set -ex \ + && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ + && tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ + && mv boost_${BOOST_VERSION} boost \ + && cd boost \ + && ./bootstrap.sh \ + && ./b2 --build-type=minimal link=static -j4 runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --stagedir=stage threading=multi threadapi=pthread cflags="-fPIC" cxxflags="-fPIC" stage + +# LMDB +ARG LMDB_VERSION=LMDB_0.9.22 +ARG LMDB_HASH=5033a08c86fb6ef0adddabad327422a1c0c0069a +RUN set -ex \ + && git clone https://github.com/LMDB/lmdb.git -b ${LMDB_VERSION} \ + && cd lmdb \ +&& test `git rev-parse HEAD` = ${LMDB_HASH} || exit 1 + +COPY . /app/bytecoin + +RUN mkdir /app/bytecoin/build \ + && cd bytecoin/build \ + && cmake .. \ + && time make -j4 \ + && cp -v ../bin/* /usr/local/bin \ + && bytecoind -v From a2e22d86e4765e5005ba5ef06657d51ab55aa445 Mon Sep 17 00:00:00 2001 From: HomDx Date: Thu, 9 Aug 2018 21:39:13 +0300 Subject: [PATCH 2/7] Dockerfile: clean temporary files and remove build essential --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1cd93f27..6828a345 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ #Use Fedora 28 docker image FROM fedora -RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel && dnf clean all +RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel WORKDIR /app @@ -24,13 +24,20 @@ ARG LMDB_HASH=5033a08c86fb6ef0adddabad327422a1c0c0069a RUN set -ex \ && git clone https://github.com/LMDB/lmdb.git -b ${LMDB_VERSION} \ && cd lmdb \ -&& test `git rev-parse HEAD` = ${LMDB_HASH} || exit 1 + && test `git rev-parse HEAD` = ${LMDB_HASH} || exit 1 COPY . /app/bytecoin -RUN mkdir /app/bytecoin/build \ +RUN set -ex \ + && mkdir /app/bytecoin/build \ && cd bytecoin/build \ && cmake .. \ && time make -j4 \ && cp -v ../bin/* /usr/local/bin \ + && dnf remove -y make gcc-c++ cmake git wget openssl-devel \ + && dnf install libstdc++ -y \ + && dnf clean all \ + && rm -rf /app \ + && echo '[ SHOW VERSION ]' \ && bytecoind -v + From ab4be7aa7208434b773ecb31fc9d0fb082054e84 Mon Sep 17 00:00:00 2001 From: HomDx Date: Thu, 9 Aug 2018 23:46:51 +0300 Subject: [PATCH 3/7] Multistage docker build --- Dockerfile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6828a345..674ecd90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,10 @@ -#Use Fedora 28 docker image -FROM fedora +# Use Fedora 28 docker image +# Multistage docker build, requires docker 17.05 +FROM fedora:28 as builder + +# If you have an old version of the docker, then +# correct the previous line, it should be the +# FROM fedora RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel @@ -41,3 +46,18 @@ RUN set -ex \ && echo '[ SHOW VERSION ]' \ && bytecoind -v +# If you have an old version of the docker: +# (not supported Multistage docker build) +# Please comment all the lines below this! + +FROM fedora:28 + +RUN set -ex \ + && dnf update -y \ + && dnf install libstdc++ -y \ + && dnf clean all + +COPY --from=builder /usr/local/bin/* /usr/local/bin/ + +RUN echo '[ SHOW VERSION ]' \ + && bytecoind -v From 8e8309d5fa217049401e1919f2cd676c3416e0f4 Mon Sep 17 00:00:00 2001 From: homdx <37062532+homdx@users.noreply.github.com> Date: Thu, 30 Aug 2018 01:05:00 +0300 Subject: [PATCH 4/7] Add tests and update Boost to 1.68 Addind tests feature: Docker can build, then tests is not passed Update Boost to 1.68 --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 674ecd90..7cd53e6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,9 @@ RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 wh WORKDIR /app ## Boost -ARG BOOST_VERSION=1_67_0 -ARG BOOST_VERSION_DOT=1.67.0 -ARG BOOST_HASH=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba +ARG BOOST_VERSION=1_68_0 +ARG BOOST_VERSION_DOT=1.68.0 +ARG BOOST_HASH=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 RUN set -ex \ && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ @@ -39,6 +39,8 @@ RUN set -ex \ && cmake .. \ && time make -j4 \ && cp -v ../bin/* /usr/local/bin \ + && mkdir /usr/local/bin/wallet_file \ + && cp -v ../tests/wallet_file/* /usr/local/bin/wallet_file \ && dnf remove -y make gcc-c++ cmake git wget openssl-devel \ && dnf install libstdc++ -y \ && dnf clean all \ @@ -59,5 +61,9 @@ RUN set -ex \ COPY --from=builder /usr/local/bin/* /usr/local/bin/ -RUN echo '[ SHOW VERSION ]' \ +RUN ls -la /usr/local/bin/ \ + && mkdir -p /tests/wallet_file \ + && cp /usr/local/bin/*.wallet /tests/wallet_file/ \ + && cd /tests && tests || : \ + && echo '[ SHOW VERSION ]' \ && bytecoind -v From 2503170593a27d545a0f2f023632deac287ea7ff Mon Sep 17 00:00:00 2001 From: HomDx Date: Thu, 30 Aug 2018 01:18:51 +0300 Subject: [PATCH 5/7] Revert Boost to 1.67 --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7cd53e6d..cc9ad167 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,9 @@ RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 wh WORKDIR /app ## Boost -ARG BOOST_VERSION=1_68_0 -ARG BOOST_VERSION_DOT=1.68.0 -ARG BOOST_HASH=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 +ARG BOOST_VERSION=1_67_0 +ARG BOOST_VERSION_DOT=1.67.0 +ARG BOOST_HASH=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba RUN set -ex \ && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ From 1046ace743dcb6036e885eb0d8240cfb8f04cbb2 Mon Sep 17 00:00:00 2001 From: homdx <37062532+homdx@users.noreply.github.com> Date: Thu, 30 Aug 2018 02:05:47 +0300 Subject: [PATCH 6/7] Added information about Alpine image Added information about Alpine image --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bdb0ec9..4d02cf94 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,10 @@ Contents [![](https://images.microbadger.com/badges/version/homdx/bytecoin.svg)](https://microbadger.com/images/homdx/bytecoin "Get your own version badge on microbadger.com") -- docker pull homdx/bytecoin +docker pull homdx/bytecoin +### docker pull homdx/bytecoin:alpine + +Test Alpine docker image. In the future it will be possible to make this image basic (according to your feedback) ### You can check the result and build logs https://hub.docker.com/r/homdx/bytecoin/ From dac06462e08dae038c3d75f9e96e4695a591a29d Mon Sep 17 00:00:00 2001 From: HomDx Date: Mon, 3 Sep 2018 20:23:52 +0300 Subject: [PATCH 7/7] Improve build speed Docker: Use cached layer: dnf update and install libsdc++ --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cc9ad167..47c775c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,14 @@ FROM fedora:28 as builder # correct the previous line, it should be the # FROM fedora -RUN dnf -y update && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel +RUN set -ex \ + && dnf update -y \ + && dnf install libstdc++ -y \ + && dnf clean all + +RUN set -ex \ + && dnf update -y \ + && dnf -y install make gcc-c++ cmake git wget libzip bzip2 which openssl-devel WORKDIR /app