Draft: Draft: Slimmed Ubuntu 2004 image, ubuntu base image, and directory restructure #780

Closed
rilesdun wants to merge 5 commits from docker-build-fix into develop
6 changed files with 400 additions and 194 deletions

View file

@ -1 +0,0 @@
build

View file

@ -1,193 +0,0 @@
FROM ubuntu:20.04
MAINTAINER Peerplays Blockchain Standards Association
#===============================================================================
# Ubuntu setup
#===============================================================================
RUN \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-utils \
autoconf \
bash \
bison \
build-essential \
ca-certificates \
dnsutils \
expect \
flex \
git \
graphviz \
libbz2-dev \
libcurl4-openssl-dev \
libncurses-dev \
libsnappy-dev \
libssl-dev \
libtool \
libzip-dev \
locales \
lsb-release \
mc \
nano \
net-tools \
ntp \
openssh-server \
pkg-config \
python3 \
python3-jinja2 \
sudo \
systemd-coredump \
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
#===============================================================================
# Boost setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
wget https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.gz && \
tar -xzvf boost_1_72_0.tar.gz boost_1_72_0 && \
cd boost_1_72_0/ && \
./bootstrap.sh && \
./b2 install
#===============================================================================
# cmake setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
wget -c 'https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.sh' -O cmake-3.23.1-linux-x86_64.sh && \
chmod 755 ./cmake-3.23.1-linux-x86_64.sh && \
./cmake-3.23.1-linux-x86_64.sh --prefix=/usr/ --skip-license && \
cmake --version
#===============================================================================
# libzmq setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.zip && \
unzip v4.3.4.zip && \
cd libzmq-4.3.4 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# cppzmq setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.zip && \
unzip v4.8.1.zip && \
cd cppzmq-4.8.1 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# Doxygen setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
sudo apt install -y bison flex && \
wget https://github.com/doxygen/doxygen/archive/refs/tags/Release_1_8_17.tar.gz && \
tar -xvf Release_1_8_17.tar.gz && \
cd doxygen-Release_1_8_17 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# Perl setup
#===============================================================================
WORKDIR /home/peerplays/
RUN \
wget https://github.com/Perl/perl5/archive/refs/tags/v5.30.0.tar.gz && \
tar -xvf v5.30.0.tar.gz && \
cd perl5-5.30.0 && \
./Configure -des && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# 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 \
cd peerplays && \
git submodule update --init --recursive && \
git symbolic-ref --short HEAD && \
git log --oneline -n 5 && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release ..
# Build Peerplays
RUN \
cd peerplays/build && \
make -j$(nproc) cli_wallet witness_node
WORKDIR /home/peerplays/peerplays-network
# 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
# Peerplays P2P:
EXPOSE 9777
# Peerplays
CMD ["./witness_node", "-d", "./witness_node_data_dir"]

View file

@ -0,0 +1,40 @@
FROM ubuntu:20.04
LABEL Peerplays Blockchain Standards Association
RUN \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libzmq5 \
apt-utils \
autoconf \
bash \
build-essential \
ca-certificates \
cmake \
curl \
dnsutils \
doxygen \
expect \
git \
graphviz \
libboost-all-dev \
libbz2-dev \
libcurl4-openssl-dev \
libncurses-dev \
libsnappy-dev \
libssl-dev \
libtool \
libzip-dev \
locales \
lsb-release \
mc \
nano \
net-tools \
ntp \
pkg-config \
perl \
python3 \
python3-jinja2 \
sudo \
systemd-coredump \
wget

View file

@ -0,0 +1,82 @@
FROM peerplays/ubuntu-build:20.04 AS deps
LABEL Peerplays Blockchain Standards Association
RUN groupadd peerplays && \
useradd -rm -d /home/peerplays -s /bin/bash -g peerplays -u 1000 peerplays
WORKDIR /home/peerplays/
#===============================================================================
# libzmq setup
#===============================================================================
RUN \
wget https://github.com/zeromq/libzmq/archive/refs/tags/v4.3.4.zip && \
unzip v4.3.4.zip && \
cd libzmq-4.3.4 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# cppzmq setup
#===============================================================================
RUN \
wget https://github.com/zeromq/cppzmq/archive/refs/tags/v4.8.1.zip && \
unzip v4.8.1.zip && \
cd cppzmq-4.8.1 && \
mkdir build && \
cd build && \
cmake .. && \
make -j$(nproc) install && \
ldconfig
#===============================================================================
# Peerplays setup
#===============================================================================
# Add local source
ADD . peerplays
# Configure and build Peerplays
RUN \
cd peerplays && \
git submodule update --init --recursive && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j$(nproc) cli_wallet witness_node && \
chown -R peerplays:peerplays /home/peerplays/
# Fresh image for running compiled binaries
FROM ubuntu:20.04
WORKDIR /home/peerplays/witness_node_data_dir/
COPY --from=deps /home/peerplays/peerplays/example.config.ini /home/peerplays/witness_node_data_dir/config.ini
RUN apt update -y && \
DEBIAN_FRONTEND=noninteractive apt install -y \
curl \
nano \
libzmq5 && \
groupadd peerplays && \
useradd -rm -d /home/peerplays -s /bin/bash -g peerplays -u 1000 peerplays && \
chown -R peerplays:peerplays /home/peerplays/
USER peerplays
WORKDIR /home/peerplays/
# Copying the build artifacts from the above ubuntu-build image
COPY --from=deps /home/peerplays/peerplays/build/programs/witness_node/witness_node .
COPY --from=deps /home/peerplays/peerplays/build/programs/cli_wallet/cli_wallet .
# Peerplays RPC
EXPOSE 8090
# Peerplays P2P:
EXPOSE 9777
# Peerplays
CMD ["./witness_node", "-d", "./witness_node_data_dir"]

278
example.config.ini Normal file
View file

@ -0,0 +1,278 @@
# Endpoint for P2P node to listen on
p2p-endpoint = 0.0.0.0:9777
# 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 = ["51.222.110.110:9777","95.216.90.243:9777","ca.peerplays.info:9777","de.peerplays.xyz:9777","pl.peerplays.org:9777","seed.i9networks.net.br:9777","witness.serverpit.com:9777"]
# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =
# Endpoint for websocket RPC to listen on
rpc-endpoint = 127.0.0.1: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 =
# Whether to enable tracking of votes of standby witnesses and committee members. Set it to true to provide accurate data to API clients, set to false for slightly better performance.
# enable-standby-votes-tracking =
# Space-separated list of plugins to activate
plugins = account_history accounts_list affiliate_stats bookie market_history witness
# ==============================================================================
# witness plugin options
# ==============================================================================
# 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 =
# IDs of multiple witnesses controlled by this node (e.g. ["1.6.5", "1.6.6"], quotes are required)
# witness-ids =
# Tuple of [PublicKey, WIF private key] (may specify multiple times)
private-key = []
# ==============================================================================
# debug_witness plugin options
# ==============================================================================
# Tuple of [PublicKey, WIF private key] (may specify multiple times)
debug-private-key = []
# ==============================================================================
# account_history plugin options
# ==============================================================================
# Account ID to track history for (may specify multiple times)
# track-account =
# Keep only those operations in memory that are related to account history tracking
partial-operations = 1
# Maximum number of operations per account will be kept in memory
max-ops-per-account = 100
# ==============================================================================
# elasticsearch plugin options
# ==============================================================================
# Elastic Search database node url(http://localhost:9200/)
# elasticsearch-node-url =
# Number of bulk documents to index on replay(10000)
# elasticsearch-bulk-replay =
# Number of bulk documents to index on a syncronied chain(100)
# elasticsearch-bulk-sync =
# Use visitor to index additional data(slows down the replay(false))
# elasticsearch-visitor =
# Pass basic auth to elasticsearch database('')
# elasticsearch-basic-auth =
# Add a prefix to the index(peerplays-)
# elasticsearch-index-prefix =
# Save operation as object(true)
# elasticsearch-operation-object =
# Start doing ES job after block(0)
# elasticsearch-start-es-after-block =
# Save operation as string. Needed to serve history api calls(false)
# elasticsearch-operation-string =
# Mode of operation: only_save(0), only_query(1), all(2) - Default: 0
# elasticsearch-mode =
# ==============================================================================
# es_objects plugin options
# ==============================================================================
# Elasticsearch node url(http://localhost:9200/)
# es-objects-elasticsearch-url =
# Basic auth username:password('')
# es-objects-auth =
# Number of bulk documents to index on replay(10000)
# es-objects-bulk-replay =
# Number of bulk documents to index on a synchronized chain(100)
# es-objects-bulk-sync =
# Store proposal objects(true)
# es-objects-proposals =
# Store account objects(true)
# es-objects-accounts =
# Store asset objects(true)
# es-objects-assets =
# Store balances objects(true)
# es-objects-balances =
# Store limit order objects(false)
# es-objects-limit-orders =
# Store feed data(true)
# es-objects-bitasset =
# Store account role objects (true)
# es-objects-account-role =
# Store committee member objects(true)
# es-objects-committee-member =
# Store nft objects (true)
# es-objects-nft =
# Store son objects (true)
# es-objects-son =
# Store transaction objects (true)
# es-objects-transaction =
# Store vesting balance objects (true)
# es-objects-vesting-balance =
# Store witness objects (true)
# es-objects-witness =
# Store worker objects (true)
# es-objects-worker =
# Add a prefix to the index(ppobjects-)
# es-objects-index-prefix =
# Keep only current state of the objects(true)
# es-objects-keep-only-current =
# Start doing ES job after block(0)
# es-objects-start-es-after-block =
# ==============================================================================
# market_history plugin options
# ==============================================================================
# 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]
# How far back in time to track history for each bucket size, measured in the number of buckets (default: 1000)
history-per-size = 1000
# ==============================================================================
# peerplays_sidechain plugin options
# ==============================================================================
# ID of SON controlled by this node (e.g. "1.33.5", quotes are required)
# son-id =
# IDs of multiple SONs controlled by this node (e.g. ["1.33.5", "1.33.6"], quotes are required)
# son-ids =
# Tuple of [PublicKey, WIF private key] (may specify multiple times)
peerplays-private-key = []
# Sidechain retry throttling threshold
sidechain-retry-threshold = 150
# Outputs RPC calls to console
debug-rpc-calls = 0
# Bitcoin sidechain handler enabled
bitcoin-sidechain-enabled = 0
# IP address of Bitcoin node
bitcoin-node-ip = 127.0.0.1
# ZMQ port of Bitcoin node
bitcoin-node-zmq-port = 11111
# RPC port of Bitcoin node
bitcoin-node-rpc-port = 8332
# Bitcoin RPC user
bitcoin-node-rpc-user = changeme
# Bitcoin RPC password
bitcoin-node-rpc-password = changeme
# Bitcoin wallet
# bitcoin-wallet =
# Bitcoin wallet password
# bitcoin-wallet-password =
# Tuple of [Bitcoin public key, Bitcoin private key] (may specify multiple times)
bitcoin-private-key = []
# Hive sidechain handler enabled
hive-sidechain-enabled = 0
# Hive node RPC URL [http[s]://]host[:port]
hive-node-rpc-url = 127.0.0.1:28090
# Hive node RPC user
# hive-node-rpc-user =
# Hive node RPC password
# hive-node-rpc-password =
# Tuple of [Hive public key, Hive private key] (may specify multiple times)
hive-private-key = []
# ==============================================================================
# snapshot plugin options
# ==============================================================================
# Block number after which to do a snapshot
# snapshot-at-block =
# Block time (ISO format) after which to do a snapshot
# snapshot-at-time =
# Pathname of JSON file where to store the snapshot
# snapshot-to =
# ==============================================================================
# logging options
# ==============================================================================
#
# Logging configuration is loaded from logging.ini by default.
# If logging.ini exists, logging configuration added in this file will be ignored.