2017-11-17 05:14:19 +01:00
|
|
|
# Multistage docker build, requires docker 17.05
|
|
|
|
|
2020-03-13 00:59:15 +01:00
|
|
|
# TO RUN
|
|
|
|
# docker build -t loki-daemon-image .
|
|
|
|
|
|
|
|
# TO COLLECT BINARIES
|
|
|
|
# ./util/build_scripts/collect_from_docker_container.sh
|
|
|
|
|
2017-11-17 05:14:19 +01:00
|
|
|
# builder stage
|
|
|
|
FROM ubuntu:16.04 as builder
|
|
|
|
|
2018-03-19 00:07:10 +01:00
|
|
|
RUN set -ex && \
|
|
|
|
apt-get update && \
|
2020-03-12 07:47:43 +01:00
|
|
|
apt-get install -y curl apt-transport-https eatmydata && \
|
|
|
|
echo 'deb https://apt.kitware.com/ubuntu/ xenial main' >/etc/apt/sources.list.d/kitware-cmake.list && \
|
|
|
|
curl https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - && \
|
|
|
|
apt-get update && \
|
|
|
|
eatmydata apt-get --no-install-recommends --yes install \
|
2017-11-17 05:14:19 +01:00
|
|
|
ca-certificates \
|
|
|
|
cmake \
|
|
|
|
g++ \
|
|
|
|
make \
|
|
|
|
pkg-config \
|
|
|
|
graphviz \
|
|
|
|
doxygen \
|
2018-02-02 14:45:28 +01:00
|
|
|
git \
|
|
|
|
libtool-bin \
|
|
|
|
autoconf \
|
2018-07-03 18:44:03 +02:00
|
|
|
automake \
|
2018-10-29 09:17:32 +01:00
|
|
|
bzip2 \
|
|
|
|
xsltproc \
|
2020-03-12 07:47:43 +01:00
|
|
|
gperf
|
2018-02-02 14:45:28 +01:00
|
|
|
|
2020-03-12 07:47:43 +01:00
|
|
|
WORKDIR /usr/local/src
|
2018-02-02 14:45:28 +01:00
|
|
|
|
2020-04-02 21:35:42 +02:00
|
|
|
ARG OPENSSL_VERSION=1.1.1g
|
|
|
|
ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
|
2018-07-03 18:44:03 +02:00
|
|
|
RUN set -ex \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
|
|
|
|
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
|
|
|
|
&& tar xf openssl-${OPENSSL_VERSION}.tar.gz \
|
|
|
|
&& cd openssl-${OPENSSL_VERSION} \
|
|
|
|
&& ./Configure --prefix=/usr linux-x86_64 no-shared --static \
|
2020-03-13 00:59:15 +01:00
|
|
|
&& make -j$(nproc) \
|
|
|
|
&& make install_sw -j$(nproc)
|
2018-07-03 18:44:03 +02:00
|
|
|
|
2020-03-12 07:47:43 +01:00
|
|
|
ARG BOOST_VERSION=1_72_0
|
|
|
|
ARG BOOST_VERSION_DOT=1.72.0
|
|
|
|
ARG BOOST_HASH=59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722
|
2018-03-19 00:07:10 +01:00
|
|
|
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 \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& tar xf boost_${BOOST_VERSION}.tar.bz2 \
|
2018-02-02 14:45:28 +01:00
|
|
|
&& cd boost_${BOOST_VERSION} \
|
|
|
|
&& ./bootstrap.sh \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& ./b2 --prefix=/usr --build-type=minimal link=static runtime-link=static \
|
|
|
|
--with-atomic --with-chrono --with-date_time --with-filesystem --with-program_options \
|
|
|
|
--with-regex --with-serialization --with-system --with-thread --with-locale \
|
|
|
|
threading=multi threadapi=pthread cxxflags=-fPIC \
|
2020-03-13 00:59:15 +01:00
|
|
|
-j$(nproc) install
|
2018-02-02 14:45:28 +01:00
|
|
|
|
2020-03-12 07:47:43 +01:00
|
|
|
ARG SODIUM_VERSION=1.0.18-RELEASE
|
|
|
|
ARG SODIUM_HASH=940ef42797baa0278df6b7fd9e67c7590f87744b
|
2019-10-10 02:43:08 +02:00
|
|
|
RUN set -ex \
|
|
|
|
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth=1 \
|
|
|
|
&& cd libsodium \
|
|
|
|
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
|
|
|
|
&& ./autogen.sh \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& ./configure --enable-static --disable-shared --prefix=/usr \
|
2020-03-13 00:59:15 +01:00
|
|
|
&& make -j$(nproc) \
|
2019-10-10 02:43:08 +02:00
|
|
|
&& make check \
|
|
|
|
&& make install
|
|
|
|
|
2018-02-02 14:45:28 +01:00
|
|
|
# Readline
|
2019-06-24 12:21:39 +02:00
|
|
|
# ARG READLINE_VERSION=8.0
|
|
|
|
# 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 \
|
2020-03-12 07:47:43 +01:00
|
|
|
# && tar xf readline-${READLINE_VERSION}.tar.gz \
|
2019-06-24 12:21:39 +02:00
|
|
|
# && cd readline-${READLINE_VERSION} \
|
2020-03-12 07:47:43 +01:00
|
|
|
# && ./configure --prefix=/usr --disable-shared \
|
2020-03-13 00:59:15 +01:00
|
|
|
# && make -j$(nproc) \
|
2019-06-24 12:21:39 +02:00
|
|
|
# && make install
|
2018-02-02 14:45:28 +01:00
|
|
|
|
2020-02-06 06:54:34 +01:00
|
|
|
# Sqlite3
|
|
|
|
ARG SQLITE_VERSION=3310100
|
|
|
|
ARG SQLITE_HASH=62284efebc05a76f909c580ffa5c008a7d22a1287285d68b7825a2b6b51949ae
|
|
|
|
RUN set -ex \
|
|
|
|
&& curl -s -O https://sqlite.org/2020/sqlite-autoconf-${SQLITE_VERSION}.tar.gz \
|
|
|
|
&& echo "${SQLITE_HASH} sqlite-autoconf-${SQLITE_VERSION}.tar.gz" | sha256sum -c \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& tar xf sqlite-autoconf-${SQLITE_VERSION}.tar.gz \
|
2020-02-06 06:54:34 +01:00
|
|
|
&& cd sqlite-autoconf-${SQLITE_VERSION} \
|
2020-03-12 07:47:43 +01:00
|
|
|
&& ./configure --disable-shared --prefix=/usr --with-pic \
|
2020-03-13 00:59:15 +01:00
|
|
|
&& make -j$(nproc) \
|
2020-02-06 06:54:34 +01:00
|
|
|
&& make install
|
|
|
|
|
2017-11-17 05:14:19 +01:00
|
|
|
WORKDIR /src
|
|
|
|
COPY . .
|
2017-12-12 00:33:08 +01:00
|
|
|
|
2018-03-19 00:07:10 +01:00
|
|
|
RUN set -ex && \
|
2020-03-12 07:47:43 +01:00
|
|
|
git submodule update --init --recursive && \
|
|
|
|
rm -rf build/release && mkdir -p build/release && cd build/release && \
|
|
|
|
cmake -DSTATIC=ON -DARCH=x86-64 -DCMAKE_BUILD_TYPE=Release ../.. && \
|
2020-03-13 00:59:15 +01:00
|
|
|
make -j$(nproc) VERBOSE=1
|
|
|
|
|
|
|
|
RUN set -ex && \
|
|
|
|
ldd /src/build/release/bin/lokid
|
2017-11-17 05:14:19 +01:00
|
|
|
|
|
|
|
# runtime stage
|
2017-02-23 23:55:37 +01:00
|
|
|
FROM ubuntu:16.04
|
|
|
|
|
2018-03-19 00:07:10 +01:00
|
|
|
RUN set -ex && \
|
|
|
|
apt-get update && \
|
2017-11-18 07:45:39 +01:00
|
|
|
apt-get --no-install-recommends --yes install ca-certificates && \
|
2017-11-17 05:14:19 +01:00
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt
|
2018-09-25 00:14:12 +02:00
|
|
|
COPY --from=builder /src/build/release/bin /usr/local/bin/
|
2016-08-31 18:10:44 +02:00
|
|
|
|
2019-04-12 08:23:54 +02:00
|
|
|
# Create loki user
|
|
|
|
RUN adduser --system --group --disabled-password loki && \
|
|
|
|
mkdir -p /wallet /home/loki/.loki && \
|
|
|
|
chown -R loki:loki /home/loki/.loki && \
|
|
|
|
chown -R loki:loki /wallet
|
2019-03-09 23:22:03 +01:00
|
|
|
|
2016-08-31 18:10:44 +02:00
|
|
|
# Contains the blockchain
|
2019-04-12 08:23:54 +02:00
|
|
|
VOLUME /home/loki/.loki
|
2016-08-31 18:10:44 +02:00
|
|
|
|
|
|
|
# Generate your wallet via accessing the container and run:
|
|
|
|
# cd /wallet
|
2018-05-22 03:46:34 +02:00
|
|
|
# loki-wallet-cli
|
2016-08-31 18:10:44 +02:00
|
|
|
VOLUME /wallet
|
|
|
|
|
2019-03-18 00:49:14 +01:00
|
|
|
EXPOSE 22022
|
|
|
|
EXPOSE 22023
|
2016-08-31 18:10:44 +02:00
|
|
|
|
2019-03-09 23:22:03 +01:00
|
|
|
# switch to user monero
|
2019-04-12 08:23:54 +02:00
|
|
|
USER loki
|
2019-03-09 23:22:03 +01:00
|
|
|
|
2018-09-19 05:44:41 +02:00
|
|
|
ENTRYPOINT ["lokid", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=22022", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=22023", "--non-interactive", "--confirm-external-bind"]
|