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
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
- make -j$(nproc)
|
||||
- make -j4
|
||||
artifacts:
|
||||
untracked: true
|
||||
paths:
|
||||
|
|
|
|||
134
Dockerfile
134
Dockerfile
|
|
@ -1,13 +1,14 @@
|
|||
FROM ubuntu:18.04
|
||||
FROM ubuntu:20.04
|
||||
MAINTAINER PeerPlays Blockchain Standards Association
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US.UTF-8
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
#===============================================================================
|
||||
# Ubuntu setup
|
||||
#===============================================================================
|
||||
|
||||
RUN \
|
||||
apt-get update -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
apt-utils \
|
||||
autoconf \
|
||||
bash \
|
||||
build-essential \
|
||||
|
|
@ -15,82 +16,89 @@ RUN \
|
|||
cmake \
|
||||
dnsutils \
|
||||
doxygen \
|
||||
expect \
|
||||
git \
|
||||
graphviz \
|
||||
libboost1.67-all-dev \
|
||||
libbz2-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libncurses-dev \
|
||||
libreadline-dev \
|
||||
libsnappy-dev \
|
||||
libssl-dev \
|
||||
libtool \
|
||||
libzip-dev \
|
||||
libzmq3-dev \
|
||||
locales \
|
||||
mc \
|
||||
nano \
|
||||
net-tools \
|
||||
ntp \
|
||||
openssh-server \
|
||||
pkg-config \
|
||||
wget \
|
||||
&& \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
perl \
|
||||
python3 \
|
||||
python3-jinja2 \
|
||||
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 \
|
||||
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
|
||||
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 && \
|
||||
cd peerplays && \
|
||||
mkdir build && \
|
||||
mkdir build/release && \
|
||||
cd build/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
|
||||
cd build && \
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
# Home directory $HOME
|
||||
WORKDIR /
|
||||
RUN useradd -s /bin/bash -m -d /var/lib/peerplays peerplays
|
||||
ENV HOME /var/lib/peerplays
|
||||
RUN chown peerplays:peerplays -R /var/lib/peerplays
|
||||
# Build Peerplays
|
||||
RUN \
|
||||
cd peerplays/build && \
|
||||
make -j$(nproc) cli_wallet witness_node
|
||||
|
||||
# Volume
|
||||
VOLUME ["/var/lib/peerplays", "/etc/peerplays"]
|
||||
WORKDIR /home/peerplays/peerplays-network
|
||||
|
||||
# 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
|
||||
# p2p service:
|
||||
EXPOSE 1776
|
||||
# Peerplays P2P:
|
||||
EXPOSE 9777
|
||||
|
||||
# default exec/config files
|
||||
ADD docker/default_config.ini /etc/peerplays/config.ini
|
||||
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"]
|
||||
# Peerplays
|
||||
CMD ["./witness_node", "-d", "./witness_node_data_dir"]
|
||||
|
|
|
|||
|
|
@ -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