Fix Docker build
This commit is contained in:
parent
2ba8a7f3a5
commit
861e9389ac
4 changed files with 72 additions and 212 deletions
|
|
@ -19,7 +19,7 @@ build:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -DCMAKE_BUILD_TYPE=Release ..
|
- cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
- make -j$(nproc)
|
- make -j4
|
||||||
artifacts:
|
artifacts:
|
||||||
untracked: true
|
untracked: true
|
||||||
paths:
|
paths:
|
||||||
|
|
|
||||||
134
Dockerfile
134
Dockerfile
|
|
@ -1,13 +1,14 @@
|
||||||
FROM ubuntu:18.04
|
FROM ubuntu:20.04
|
||||||
MAINTAINER PeerPlays Blockchain Standards Association
|
MAINTAINER PeerPlays Blockchain Standards Association
|
||||||
|
|
||||||
ENV LANG en_US.UTF-8
|
#===============================================================================
|
||||||
ENV LANGUAGE en_US.UTF-8
|
# Ubuntu setup
|
||||||
ENV LC_ALL en_US.UTF-8
|
#===============================================================================
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt-get update -y && \
|
apt-get update -y && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
|
apt-utils \
|
||||||
autoconf \
|
autoconf \
|
||||||
bash \
|
bash \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
|
@ -15,82 +16,89 @@ RUN \
|
||||||
cmake \
|
cmake \
|
||||||
dnsutils \
|
dnsutils \
|
||||||
doxygen \
|
doxygen \
|
||||||
|
expect \
|
||||||
git \
|
git \
|
||||||
graphviz \
|
graphviz \
|
||||||
|
libboost1.67-all-dev \
|
||||||
libbz2-dev \
|
libbz2-dev \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
libncurses-dev \
|
libncurses-dev \
|
||||||
libreadline-dev \
|
libreadline-dev \
|
||||||
|
libsnappy-dev \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
libtool \
|
libtool \
|
||||||
|
libzip-dev \
|
||||||
libzmq3-dev \
|
libzmq3-dev \
|
||||||
locales \
|
locales \
|
||||||
|
mc \
|
||||||
|
nano \
|
||||||
|
net-tools \
|
||||||
ntp \
|
ntp \
|
||||||
|
openssh-server \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
wget \
|
perl \
|
||||||
&& \
|
python3 \
|
||||||
apt-get clean && \
|
python3-jinja2 \
|
||||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
sudo \
|
||||||
|
wget
|
||||||
|
|
||||||
|
ENV HOME /home/peerplays
|
||||||
|
RUN useradd -rm -d /home/peerplays -s /bin/bash -g root -G sudo -u 1000 peerplays
|
||||||
|
RUN echo "peerplays ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/peerplays
|
||||||
|
RUN chmod 440 /etc/sudoers.d/peerplays
|
||||||
|
|
||||||
|
RUN service ssh start
|
||||||
|
RUN echo 'peerplays:peerplays' | chpasswd
|
||||||
|
|
||||||
|
# SSH
|
||||||
|
EXPOSE 22
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Peerplays setup
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
WORKDIR /home/peerplays/
|
||||||
|
|
||||||
|
## Clone Peerplays
|
||||||
|
#RUN \
|
||||||
|
# git clone https://gitlab.com/PBSA/peerplays.git && \
|
||||||
|
# cd peerplays && \
|
||||||
|
# git checkout develop && \
|
||||||
|
# git submodule update --init --recursive && \
|
||||||
|
# git branch --show-current && \
|
||||||
|
# git log --oneline -n 5
|
||||||
|
|
||||||
|
# Add local source
|
||||||
|
ADD . peerplays
|
||||||
|
|
||||||
|
# Configure Peerplays
|
||||||
RUN \
|
RUN \
|
||||||
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
cd peerplays && \
|
||||||
locale-gen
|
|
||||||
|
|
||||||
# Compile Boost
|
|
||||||
RUN \
|
|
||||||
BOOST_ROOT=$HOME/boost_1_67_0 && \
|
|
||||||
wget -c 'http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.gz/download' -O boost_1_67_0.tar.gz &&\
|
|
||||||
tar -zxvf boost_1_67_0.tar.gz && \
|
|
||||||
cd boost_1_67_0/ && \
|
|
||||||
./bootstrap.sh "--prefix=$BOOST_ROOT" && \
|
|
||||||
./b2 install && \
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
ADD . /peerplays-core
|
|
||||||
WORKDIR /peerplays-core
|
|
||||||
|
|
||||||
# Compile Peerplays
|
|
||||||
RUN \
|
|
||||||
BOOST_ROOT=$HOME/boost_1_67_0 && \
|
|
||||||
git submodule sync --recursive && \
|
|
||||||
git submodule update --init --recursive && \
|
|
||||||
mkdir build && \
|
mkdir build && \
|
||||||
mkdir build/release && \
|
cd build && \
|
||||||
cd build/release && \
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
cmake \
|
|
||||||
-DBOOST_ROOT="$BOOST_ROOT" \
|
|
||||||
-DCMAKE_BUILD_TYPE=Debug \
|
|
||||||
../.. && \
|
|
||||||
make witness_node cli_wallet && \
|
|
||||||
install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \
|
|
||||||
#
|
|
||||||
# Obtain version
|
|
||||||
mkdir /etc/peerplays && \
|
|
||||||
git rev-parse --short HEAD > /etc/peerplays/version && \
|
|
||||||
cd / && \
|
|
||||||
rm -rf /peerplays-core
|
|
||||||
|
|
||||||
# Home directory $HOME
|
# Build Peerplays
|
||||||
WORKDIR /
|
RUN \
|
||||||
RUN useradd -s /bin/bash -m -d /var/lib/peerplays peerplays
|
cd peerplays/build && \
|
||||||
ENV HOME /var/lib/peerplays
|
make -j$(nproc) cli_wallet witness_node
|
||||||
RUN chown peerplays:peerplays -R /var/lib/peerplays
|
|
||||||
|
|
||||||
# Volume
|
WORKDIR /home/peerplays/peerplays-network
|
||||||
VOLUME ["/var/lib/peerplays", "/etc/peerplays"]
|
|
||||||
|
|
||||||
# rpc service:
|
# Setup Peerplays runimage
|
||||||
|
RUN \
|
||||||
|
ln -s /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet ./ && \
|
||||||
|
ln -s /home/peerplays/peerplays/build/programs/witness_node/witness_node ./
|
||||||
|
|
||||||
|
RUN ./witness_node --create-genesis-json genesis.json && \
|
||||||
|
rm genesis.json
|
||||||
|
|
||||||
|
RUN chown peerplays:root -R /home/peerplays/peerplays-network
|
||||||
|
|
||||||
|
# Peerplays RPC
|
||||||
EXPOSE 8090
|
EXPOSE 8090
|
||||||
# p2p service:
|
# Peerplays P2P:
|
||||||
EXPOSE 1776
|
EXPOSE 9777
|
||||||
|
|
||||||
# default exec/config files
|
# Peerplays
|
||||||
ADD docker/default_config.ini /etc/peerplays/config.ini
|
CMD ["./witness_node", "-d", "./witness_node_data_dir"]
|
||||||
ADD docker/peerplaysentry.sh /usr/local/bin/peerplaysentry.sh
|
|
||||||
RUN chmod a+x /usr/local/bin/peerplaysentry.sh
|
|
||||||
|
|
||||||
# Make Docker send SIGINT instead of SIGTERM to the daemon
|
|
||||||
STOPSIGNAL SIGINT
|
|
||||||
|
|
||||||
# default execute entry
|
|
||||||
CMD ["/usr/local/bin/peerplaysentry.sh"]
|
|
||||||
|
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
# Endpoint for P2P node to listen on
|
|
||||||
p2p-endpoint = 0.0.0.0:9090
|
|
||||||
|
|
||||||
# P2P nodes to connect to on startup (may specify multiple times)
|
|
||||||
# seed-node =
|
|
||||||
|
|
||||||
# JSON array of P2P nodes to connect to on startup
|
|
||||||
# seed-nodes =
|
|
||||||
|
|
||||||
# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
|
|
||||||
# checkpoint =
|
|
||||||
|
|
||||||
# Endpoint for websocket RPC to listen on
|
|
||||||
rpc-endpoint = 0.0.0.0:8090
|
|
||||||
|
|
||||||
# Endpoint for TLS websocket RPC to listen on
|
|
||||||
# rpc-tls-endpoint =
|
|
||||||
|
|
||||||
# The TLS certificate file for this server
|
|
||||||
# server-pem =
|
|
||||||
|
|
||||||
# Password for this certificate
|
|
||||||
# server-pem-password =
|
|
||||||
|
|
||||||
# File to read Genesis State from
|
|
||||||
# genesis-json =
|
|
||||||
|
|
||||||
# Block signing key to use for init witnesses, overrides genesis file
|
|
||||||
# dbg-init-key =
|
|
||||||
|
|
||||||
# JSON file specifying API permissions
|
|
||||||
# api-access =
|
|
||||||
|
|
||||||
# Enable block production, even if the chain is stale.
|
|
||||||
enable-stale-production = false
|
|
||||||
|
|
||||||
# Percent of witnesses (0-99) that must be participating in order to produce blocks
|
|
||||||
required-participation = false
|
|
||||||
|
|
||||||
# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
|
|
||||||
# witness-id =
|
|
||||||
|
|
||||||
# Tuple of [PublicKey, WIF private key] (may specify multiple times)
|
|
||||||
# private-key = ["BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
|
|
||||||
|
|
||||||
# Account ID to track history for (may specify multiple times)
|
|
||||||
# track-account =
|
|
||||||
|
|
||||||
# Track market history by grouping orders into buckets of equal size measured in seconds specified as a JSON array of numbers
|
|
||||||
# bucket-size = [15,60,300,3600,86400]
|
|
||||||
bucket-size = [60,300,900,1800,3600,14400,86400]
|
|
||||||
# for 1 min, 5 mins, 30 mins, 1h, 4 hs and 1 day. i think this should be the default.
|
|
||||||
|
|
||||||
# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000)
|
|
||||||
history-per-size = 1000
|
|
||||||
|
|
||||||
# Max amount of operations to store in the database, per account (drastically reduces RAM requirements)
|
|
||||||
max-ops-per-account = 1000
|
|
||||||
|
|
||||||
# Remove old operation history # objects from RAM
|
|
||||||
partial-operations = true
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
PEERPLAYSD="/usr/local/bin/witness_node"
|
|
||||||
|
|
||||||
# For blockchain download
|
|
||||||
VERSION=`cat /etc/peerplays/version`
|
|
||||||
|
|
||||||
## Supported Environmental Variables
|
|
||||||
#
|
|
||||||
# * $PEERPLAYSD_SEED_NODES
|
|
||||||
# * $PEERPLAYSD_RPC_ENDPOINT
|
|
||||||
# * $PEERPLAYSD_PLUGINS
|
|
||||||
# * $PEERPLAYSD_REPLAY
|
|
||||||
# * $PEERPLAYSD_RESYNC
|
|
||||||
# * $PEERPLAYSD_P2P_ENDPOINT
|
|
||||||
# * $PEERPLAYSD_WITNESS_ID
|
|
||||||
# * $PEERPLAYSD_PRIVATE_KEY
|
|
||||||
# * $PEERPLAYSD_DEBUG_PRIVATE_KEY
|
|
||||||
# * $PEERPLAYSD_TRACK_ACCOUNTS
|
|
||||||
# * $PEERPLAYSD_PARTIAL_OPERATIONS
|
|
||||||
# * $PEERPLAYSD_MAX_OPS_PER_ACCOUNT
|
|
||||||
# * $PEERPLAYSD_TRUSTED_NODE
|
|
||||||
#
|
|
||||||
|
|
||||||
ARGS=""
|
|
||||||
# Translate environmental variables
|
|
||||||
if [[ ! -z "$PEERPLAYSD_SEED_NODES" ]]; then
|
|
||||||
for NODE in $PEERPLAYSD_SEED_NODES ; do
|
|
||||||
ARGS+=" --seed-node=$NODE"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [[ ! -z "$PEERPLAYSD_RPC_ENDPOINT" ]]; then
|
|
||||||
ARGS+=" --rpc-endpoint=${PEERPLAYSD_RPC_ENDPOINT}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_REPLAY" ]]; then
|
|
||||||
ARGS+=" --replay-blockchain"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_RESYNC" ]]; then
|
|
||||||
ARGS+=" --resync-blockchain"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_P2P_ENDPOINT" ]]; then
|
|
||||||
ARGS+=" --p2p-endpoint=${PEERPLAYSD_P2P_ENDPOINT}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_WITNESS_ID" ]]; then
|
|
||||||
ARGS+=" --witness-id=$PEERPLAYSD_WITNESS_ID"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_PRIVATE_KEY" ]]; then
|
|
||||||
ARGS+=" --private-key=$PEERPLAYSD_PRIVATE_KEY"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_DEBUG_PRIVATE_KEY" ]]; then
|
|
||||||
ARGS+=" --debug-private-key=$PEERPLAYSD_DEBUG_PRIVATE_KEY"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_TRACK_ACCOUNTS" ]]; then
|
|
||||||
for ACCOUNT in $PEERPLAYSD_TRACK_ACCOUNTS ; do
|
|
||||||
ARGS+=" --track-account=$ACCOUNT"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_PARTIAL_OPERATIONS" ]]; then
|
|
||||||
ARGS+=" --partial-operations=${PEERPLAYSD_PARTIAL_OPERATIONS}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_MAX_OPS_PER_ACCOUNT" ]]; then
|
|
||||||
ARGS+=" --max-ops-per-account=${PEERPLAYSD_MAX_OPS_PER_ACCOUNT}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$PEERPLAYSD_TRUSTED_NODE" ]]; then
|
|
||||||
ARGS+=" --trusted-node=${PEERPLAYSD_TRUSTED_NODE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Link the peerplays config file into home
|
|
||||||
## This link has been created in Dockerfile, already
|
|
||||||
ln -f -s /etc/peerplays/config.ini /var/lib/peerplays
|
|
||||||
|
|
||||||
# Plugins need to be provided in a space-separated list, which
|
|
||||||
# makes it necessary to write it like this
|
|
||||||
if [[ ! -z "$PEERPLAYSD_PLUGINS" ]]; then
|
|
||||||
$PEERPLAYSD --data-dir ${HOME} ${ARGS} ${PEERPLAYSD_ARGS} --plugins "${PEERPLAYSD_PLUGINS}"
|
|
||||||
else
|
|
||||||
$PEERPLAYSD --data-dir ${HOME} ${ARGS} ${PEERPLAYSD_ARGS}
|
|
||||||
fi
|
|
||||||
Loading…
Reference in a new issue