Merge pull request 'Dockerfile, speed up CI building' (#299) from wowario/wownero:readme into master

Reviewed-on: https://git.wownero.com/wownero/wownero/pulls/299
This commit is contained in:
jwinterm 2020-07-23 05:20:02 +00:00
commit 3d0153dd8e
4 changed files with 194 additions and 119 deletions

View File

@ -7,4 +7,4 @@ steps:
- name: wow-ci - name: wow-ci
image: wow-dependencies:v1.0 image: wow-dependencies:v1.0
commands: commands:
- make release-static-linux-x86_64 - make -j2 release-static-linux-x86_64

View File

@ -1,13 +1,25 @@
# Multistage docker build, requires docker 17.05 ARG DEBIAN_VERSION="${DEBIAN_VERSION:-stable-slim}"
FROM debian:${DEBIAN_VERSION} as git-wow
# builder stage WORKDIR /data
FROM ubuntu:16.04 as builder
RUN set -ex && \ #Cmake
apt-get update && \ ARG CMAKE_VERSION=3.14.6
apt-get --no-install-recommends --yes install \ ARG CMAKE_VERSION_DOT=v3.14
ARG CMAKE_HASH=4e8ea11cabe459308671b476469eace1622e770317a15951d7b55a82ccaaccb9
## Boost
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
ENV CFLAGS='-fPIC -O2 -g'
ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
ENV BASE_DIR /usr/local
RUN apt-get update -qq && apt-get --no-install-recommends -yqq install \
ca-certificates \ ca-certificates \
cmake \
g++ \ g++ \
make \ make \
pkg-config \ pkg-config \
@ -19,132 +31,193 @@ RUN set -ex && \
bzip2 \ bzip2 \
xsltproc \ xsltproc \
gperf \ gperf \
unzip unzip > /dev/null \
&& cd /data || exit 1 \
WORKDIR /usr/local && echo "\e[32mbuilding: Cmake\e[39m" \
&& set -ex \
ENV CFLAGS='-fPIC' && curl -s -O https://cmake.org/files/${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION}.tar.gz > /dev/null \
ENV CXXFLAGS='-fPIC'
#Cmake
ARG CMAKE_VERSION=3.14.6
ARG CMAKE_VERSION_DOT=v3.14
ARG CMAKE_HASH=4e8ea11cabe459308671b476469eace1622e770317a15951d7b55a82ccaaccb9
RUN set -ex \
&& curl -s -O https://cmake.org/files/${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION}.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}.tar.gz" | sha256sum -c \ && echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf cmake-${CMAKE_VERSION}.tar.gz \ && tar -xzf cmake-${CMAKE_VERSION}.tar.gz > /dev/null \
&& cd cmake-${CMAKE_VERSION} \ && cd cmake-${CMAKE_VERSION} || exit 1 \
&& ./configure \ && echo "\e[32mmatrix style build text redirected to /dev/null. This will take some time. Go ahead make some coffee and check your emails.\e[39m" \
&& make \ && ./configure --prefix=$BASE_DIR > /dev/null \
&& make install && make > /dev/null \
&& make install > /dev/null \
## Boost && cd /data || exit 1 \
ARG BOOST_VERSION=1_70_0 && rm -rf /data/cmake-${CMAKE_VERSION} \
ARG BOOST_VERSION_DOT=1.70.0 && rm -rf /data/cmake-${CMAKE_VERSION}.tar.gz \
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 && echo "\e[32mbuilding: Boost\e[39m" \
RUN set -ex \ && 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 \ && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 > /dev/null \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ && tar -xvf boost_${BOOST_VERSION}.tar.bz2 > /dev/null \
&& cd boost_${BOOST_VERSION} \ && cd boost_${BOOST_VERSION} || exit 1 \
&& ./bootstrap.sh \ && ./bootstrap.sh > /dev/null \
&& ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale threading=multi threadapi=pthread cflags="$CFLAGS" cxxflags="$CXXFLAGS" stage && ./b2 -a install --prefix=$BASE_DIR --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale threading=multi threadapi=pthread cflags="$CFLAGS" cxxflags="$CXXFLAGS" stage > /dev/null \
ENV BOOST_ROOT /usr/local/boost_${BOOST_VERSION} && cd /data || exit 1 \
&& rm -rf /data/boost_${BOOST_VERSION} \
&& rm -rf /data/boost_${BOOST_VERSION}.tar.bz2
WORKDIR /data
ENV BASE_DIR /usr/local
# OpenSSL # OpenSSL
ARG OPENSSL_VERSION=1.1.1g ARG OPENSSL_VERSION=1.1.1
ARG OPENSSL_FIX=g
ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46 ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
RUN set -ex \ # ZMQ
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ ARG ZMQ_VERSION=v4.3.2
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \ ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \ # zmq.hpp
&& cd openssl-${OPENSSL_VERSION} \ ARG CPPZMQ_VERSION=v4.4.1
&& ./Configure linux-x86_64 no-shared --static "$CFLAGS" \ ARG CPPZMQ_HASH=f5b36e563598d48fcc0d82e589d3596afef945ae
&& make build_generated \
&& make libcrypto.a \
&& make install
ENV OPENSSL_ROOT_DIR=/usr/local/openssl-${OPENSSL_VERSION}
# Readline # Readline
ARG READLINE_VERSION=8.0 ARG READLINE_VERSION=8.0
ARG READLINE_HASH=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461 ARG READLINE_HASH=e339f51971478d369f8a053a330a190781acb9864cf4c541060f12078948e461
RUN set -ex \
&& curl -s -O https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz \
&& echo "${READLINE_HASH} readline-${READLINE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf readline-${READLINE_VERSION}.tar.gz \
&& cd readline-${READLINE_VERSION} \
&& ./configure \
&& make \
&& make install
# Sodium # Sodium
ARG SODIUM_VERSION=1.0.18 ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677 ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
RUN set -ex \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \ ENV CFLAGS='-fPIC -O2 -g'
&& cd libsodium \ ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
RUN echo "\e[32mbuilding: Openssl\e[39m" \
&& set -ex \
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
# && curl -s -O https://www.openssl.org/source/old/${OPENSSL_VERSION}/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz > /dev/null \
&& cd openssl-${OPENSSL_VERSION}${OPENSSL_FIX} || exit 1 \
&& ./Configure --prefix=$BASE_DIR linux-x86_64 no-shared --static "$CFLAGS" > /dev/null \
&& make build_generated > /dev/null \
&& make libcrypto.a > /dev/null \
&& echo "\e[32mblah, blah, shared libraries from the glib, something, something. Don't worry about it.\e[39m" \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/openssl-${OPENSSL_VERSION}${OPENSSL_FIX} \
&& rm -rf /data/openssl-${OPENSSL_VERSION}${OPENSSL_FIX}.tar.gz \
&& echo "\e[32mbuilding: ZMQ\e[39m" \
&& set -ex \
&& git clone --branch ${ZMQ_VERSION} --single-branch --depth 1 https://github.com/zeromq/libzmq.git > /dev/null \
&& cd libzmq || exit 1 \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --enable-libunwind=no --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& ldconfig > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libzmq \
&& echo "\e[32mbuilding: zmq.hpp\e[39m" \
&& set -ex \
&& git clone --branch ${CPPZMQ_VERSION} --single-branch --depth 1 https://github.com/zeromq/cppzmq.git > /dev/null \
&& cd cppzmq || exit 1 \
&& test `git rev-parse HEAD` = ${CPPZMQ_HASH} || exit 1 \
&& mv *.hpp $BASE_DIR/include \
&& cd /data || exit 1 \
&& rm -rf /data/cppzmq \
&& echo "\e[32mbuilding: Readline\e[39m" \
&& set -ex \
&& curl -s -O https://ftp.gnu.org/gnu/readline/readline-${READLINE_VERSION}.tar.gz > /dev/null \
&& echo "${READLINE_HASH} readline-${READLINE_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf readline-${READLINE_VERSION}.tar.gz > /dev/null \
&& cd readline-${READLINE_VERSION} || exit 1 \
&& ./configure --prefix=$BASE_DIR > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/readline-${READLINE_VERSION} \
&& rm -rf readline-${READLINE_VERSION}.tar.gz \
&& echo "\e[32mbuilding: Sodium\e[39m" \
&& set -ex \
&& git clone --branch ${SODIUM_VERSION} --single-branch --depth 1 https://github.com/jedisct1/libsodium.git > /dev/null \
&& cd libsodium || exit 1 \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \ && test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \ && ./autogen.sh \
&& ./configure \ && ./configure --prefix=$BASE_DIR > /dev/null \
&& make \ && make > /dev/null \
&& make check \ && make check > /dev/null \
&& make install && make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libsodium
WORKDIR /data
ENV BASE_DIR /usr/local
# Udev # Udev
ARG UDEV_VERSION=v3.2.8 ARG UDEV_VERSION=v3.2.8
ARG UDEV_HASH=d69f3f28348123ab7fa0ebac63ec2fd16800c5e0 ARG UDEV_HASH=d69f3f28348123ab7fa0ebac63ec2fd16800c5e0
RUN set -ex \ # Libusb
&& git clone https://github.com/gentoo/eudev -b ${UDEV_VERSION} \ ARG USB_VERSION=v1.0.22
&& cd eudev \ ARG USB_HASH=0034b2afdcdb1614e78edaa2a9e22d5936aeae5d
# Hidapi
ARG HIDAPI_VERSION=hidapi-0.8.0-rc1
ARG HIDAPI_HASH=40cf516139b5b61e30d9403a48db23d8f915f52c
# Protobuf
ARG PROTOBUF_VERSION=v3.7.1
ARG PROTOBUF_HASH=6973c3a5041636c1d8dc5f7f6c8c1f3c15bc63d6
ENV CFLAGS='-fPIC -O2 -g'
ENV CXXFLAGS='-fPIC -O2 -g'
ENV LDFLAGS='-static-libstdc++'
RUN echo "\e[32mbuilding: Udev\e[39m" \
&& set -ex \
&& git clone --branch ${UDEV_VERSION} --single-branch --depth 1 https://github.com/gentoo/eudev > /dev/null \
&& cd eudev || exit 1 \
&& test `git rev-parse HEAD` = ${UDEV_HASH} || exit 1 \ && test `git rev-parse HEAD` = ${UDEV_HASH} || exit 1 \
&& ./autogen.sh \ && ./autogen.sh \
&& ./configure --disable-gudev --disable-introspection --disable-hwdb --disable-manpages --disable-shared \ && ./configure --prefix=$BASE_DIR --disable-gudev --disable-introspection --disable-hwdb --disable-manpages --disable-shared > /dev/null \
&& make \ && make > /dev/null \
&& make install && make install > /dev/null \
&& cd /data || exit 1 \
WORKDIR /src && rm -rf /data/eudev \
COPY . . && echo "\e[32mbuilding: Libusb. Ahh, a dependency that shouldn't have been included in the codebase. Hardware wallets are way overrated.\e[39m" \
&& set -ex \
&& git clone --branch ${USB_VERSION} --single-branch --depth 1 https://github.com/libusb/libusb.git > /dev/null \
&& cd libusb || exit 1 \
&& test `git rev-parse HEAD` = ${USB_HASH} || exit 1 \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/libusb \
&& echo "\e[32mbuilding: Hidapi\e[39m" \
&& set -ex \
&& git clone --branch ${HIDAPI_VERSION} --single-branch --depth 1 https://github.com/signal11/hidapi > /dev/null \
&& cd hidapi || exit 1 \
&& test `git rev-parse HEAD` = ${HIDAPI_HASH} || exit 1 \
&& ./bootstrap \
&& ./configure --prefix=$BASE_DIR --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& cd /data || exit 1 \
&& rm -rf /data/hidapi \
&& echo "\e[32mbuilding: Protobuf <- fuck you protobuf, you worthless piece of shit!\e[39m" \
&& set -ex \
&& git clone --branch ${PROTOBUF_VERSION} --single-branch --depth 1 https://github.com/protocolbuffers/protobuf > /dev/null \
&& cd protobuf || exit 1 \
&& test `git rev-parse HEAD` = ${PROTOBUF_HASH} || exit 1 \
&& git submodule update --init --recursive > /dev/null \
&& ./autogen.sh > /dev/null \
&& ./configure --prefix=$BASE_DIR --enable-static --disable-shared > /dev/null \
&& make > /dev/null \
&& make install > /dev/null \
&& ldconfig \
&& cd /data || exit 1 \
&& rm -rf /data/protobuf
WORKDIR /home
ENV USE_SINGLE_BUILDDIR=1 ENV USE_SINGLE_BUILDDIR=1
ARG NPROC
RUN set -ex && \
git submodule init && git submodule update && \
rm -rf build && \
if [ -z "$NPROC" ] ; \
then make -j$(nproc) release-static ; \
else make -j$NPROC release-static ; \
fi
# runtime stage
FROM ubuntu:16.04
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt
COPY --from=builder /src/build/release/bin /usr/local/bin/
# Create wownero user
RUN adduser --system --group --disabled-password wownero && \
mkdir -p /wallet /home/wownero/.wownero && \
chown -R wownero:wownero /home/wownero/.wownero && \
chown -R wownero:wownero /wallet
# Contains the blockchain
VOLUME /home/wownero/.wownero
# Generate your wallet via accessing the container and run:
# cd /wallet
# wownero-wallet-cli
VOLUME /wallet
EXPOSE 34567 EXPOSE 34567
EXPOSE 34568 EXPOSE 34568
# switch to user wownero # Wownero
USER wownero RUN echo "\e[32mbuilding: Wownero\e[39m" \
&& set -ex \
ENTRYPOINT ["wownerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=34567", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=34568", "--non-interactive", "--confirm-external-bind"] && git clone https://git.wownero.com/wownero/wownero \
&& cd wownero \
&& make -j2 release-static-linux-x86_64 \
&& echo "\e[32mdone building Wownero, binaries located in: /home/wownero/build/release/bin\e[39m"

View File

@ -116,19 +116,23 @@ Packaging for your favorite distribution would be a welcome contribution!
## Building from Source ## Building from Source
* Docker
git clone https://git.wownero.com/wownero/wownero && cd wownero
docker build -t git-wow:master -m 4g .
docker run -it -p 34567:34567 -p 34568:34568 -w /home/wownero/build/release/bin git-wow:master bash
* Arch Linux/Manjaro * Arch Linux/Manjaro
sudo pacman -Syu && sudo pacman -S base-devel cmake boost openssl zeromq libpgm unbound libsodium git sudo pacman -Syu && sudo pacman -S base-devel cmake boost openssl zeromq libpgm unbound libsodium git
git clone https://git.wownero.com/wownero/wownero git clone https://git.wownero.com/wownero/wownero && cd wownero
cd wownero
make -j2 make -j2
* Debian/Ubuntu * Debian/Ubuntu
sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libpgm-dev git sudo apt update && sudo apt install build-essential cmake pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev libsodium-dev libpgm-dev git
git clone https://git.wownero.com/wownero/wownero git clone https://git.wownero.com/wownero/wownero && cd wownero
cd wownero
make -j2 make -j2

View File

@ -50,13 +50,11 @@ endif()
if(LRELEASE STREQUAL "LRELEASE-NOTFOUND") if(LRELEASE STREQUAL "LRELEASE-NOTFOUND")
set(ts_files "") set(ts_files "")
message(WARNING "lrelease program not found, translation files not built")
else() else()
execute_process(COMMAND ${LRELEASE} -version execute_process(COMMAND ${LRELEASE} -version
RESULT_VARIABLE lrelease_ret) RESULT_VARIABLE lrelease_ret)
if(NOT lrelease_ret EQUAL "0") if(NOT lrelease_ret EQUAL "0")
set(ts_files "") set(ts_files "")
message(WARNING "lrelease program not working, translation files not built")
else() else()
file(GLOB ts_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.ts) file(GLOB ts_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.ts)
foreach(ts_file ${ts_files}) foreach(ts_file ${ts_files})