Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #46 from peterwillcn/master
Browse files Browse the repository at this point in the history
Docker compile and docker-compose  start eos
  • Loading branch information
bytemaster authored Jun 27, 2017
2 parents cdc2291 + 9632da2 commit 293f720
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 74 deletions.
54 changes: 46 additions & 8 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
FROM base/archlinux:latest
MAINTAINER Nathan Hourt <nat.hourt@gmail.com>

RUN pacman --noconfirm --needed -Syu clang ninja cmake git autoconf automake make m4 binutils pkg-config libtool fakeroot boost llvm
RUN mkdir /work
WORKDIR /work
COPY * /work/
RUN bash ./bootstrap.sh
FROM ubuntu:xenial-20170619
MAINTAINER xiaobo (peterwillcn@gmail.com)

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y vim sudo wget htop iftop net-tools ca-certificates unzip

RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list \
&& echo "deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list \
&& wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y git-core automake autoconf libtool make cmake build-essential automake pkg-config libtool \
mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev clang libssl-dev \
clang-4.0 lldb-4.0 lld-4.0 \
&& rm -rf /var/lib/apt/lists/*

RUN cd /tmp && wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz \
&& tar zxf boost_1_64_0.tar.gz \
&& cd boost_1_64_0 \
&& ./bootstrap.sh --with-toolset=clang \
&& ./b2 -a -j$(nproc) stage release -sHAVE_ICU=1 --sICU_PATH=/usr \
&& ./b2 install --prefix=/usr \
&& rm -rf /tmp/boost_1_64_0*

RUN update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/clang 400 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-4.0/bin/clang++ 400

RUN cd /tmp && git clone https://github.com/cryptonomex/secp256k1-zkp.git \
&& tar zcf secp256k1-zkp.tgz secp256k1-zkp && cd secp256k1-zkp \
&& ./autogen.sh && ./configure && make && make install \
&& ldconfig && rm -rf /tmp/secp256k1-zkp*

RUN cd /tmp && git clone https://github.com/EOSIO/eos.git --recursive \
&& cd eos && mkdir build && cd build \
&& cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_STANDARD=14 -DCMAKE_INSTALL_PREFIX=/opt/eos ../ \
&& make -j$(nproc) && make install \
&& rm -rf /tmp/eos*

RUN mkdir -p /opt/eos/bin/data-dir
COPY config.ini genesis.json /
COPY entrypoint.sh /sbin
RUN cd /opt/eos/bin && chmod +x /sbin/entrypoint.sh
VOLUME /opt/eos/bin/data-dir
EXPOSE 9876 8888
ENTRYPOINT ["/sbin/entrypoint.sh"]
53 changes: 0 additions & 53 deletions Docker/PKGBUILD

This file was deleted.

23 changes: 21 additions & 2 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## Example Dockerfile
### Run in docker

This is an example Dockerfile, which demonstrates how to build Eos successfully. At present, it is not intended for any other purposes than documentation.
So simple and fast operation EOS:
- [Docker](https://docs.docker.com)
- [Docker-compose](https://github.com/docker/compose)
- [Docker-volumes](https://github.com/cpuguy83/docker-volumes)

Build eos images

```
cd eos/Docker
docker build -t eosio/eos .
```

Start docker

```
sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```

Done
11 changes: 0 additions & 11 deletions Docker/bootstrap.sh

This file was deleted.

68 changes: 68 additions & 0 deletions Docker/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# File to read Genesis State from
# genesis-json =
genesis-json = "/opt/eos/bin/data-dir/genesis.json"

# the location of the block log (absolute path or relative to application data dir)
block-log-dir = "blocks"

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# open the database in read only mode
readonly = 0

# the location of the chain shared memory files (absolute path or relative to application data dir)
shared-file-dir = "blockchain"

# Minimum size MB of database shared memory file
shared-file-size = 8192

# The local IP and port to listen for incoming http connections.
http-server-endpoint = 127.0.0.1:8888

# The local IP address and port to listen for incoming connections.
listen-endpoint = 127.0.0.1:9876

# The IP address and port of a remote peer to sync with.
# remote-endpoint =

# The public IP address and port that should be advertized to peers.
public-endpoint = 0.0.0.0:9876

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of producers (0-99) that must be participating in order to produce blocks
required-participation = false

# ID of producer controlled by this node (e.g. "init0", quotes are required, may specify multiple times)
# producer-name =
producer-name = init0
producer-name = init1
producer-name = init2
producer-name = init3
producer-name = init4
producer-name = init5
producer-name = init6
producer-name = init7
producer-name = init8
producer-name = init9
producer-name = init10
producer-name = init11
producer-name = init12
producer-name = init13
producer-name = init14
producer-name = init15
producer-name = init16
producer-name = init17
producer-name = init18
producer-name = init19
producer-name = init20

# Tuple of [PublicKey, WIF private key] (may specify multiple times)
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]

# Plugin(s) to enable, may be specified multiple times
# plugin =

plugin = eos::producer_plugin
10 changes: 10 additions & 0 deletions Docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "2"

services:
eos:
image: eosio/eos
ports:
- "8888:8888"
- "9876:9876"
volumes:
- /data/store/eos:/opt/eos/bin/data-dir
17 changes: 17 additions & 0 deletions Docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
cd /opt/eos/bin

if [ -f '/opt/eos/bin/data-dir/config.ini' ]
then
echo
else
cp /config.ini /opt/eos/bin/data-dir
fi
if [ -f '/opt/eos/bin/data-dir/genesis.json' ]
then
echo
else
cp /genesis.json /opt/eos/bin/data-dir
fi

exec /opt/eos/bin/eosd
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,27 @@ plugin = eos::producer_plugin
```

Now it should be possible to run `eosd` and see it begin producing blocks. At present, the P2P code is not implemented, so only single-node configurations are possible. When the P2P networking is implemented, this instructions will be updated to show how to create an example multi-node testnet.

### Run in docker

So simple and fast operation EOS:
- [Docker](https://docs.docker.com)
- [Docker-compose](https://github.com/docker/compose)
- [Docker-volumes](https://github.com/cpuguy83/docker-volumes)

Build eos images

```
cd eos/Docker
docker build -t eosio/eos .
```

Start docker

```
sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```

Done

0 comments on commit 293f720

Please sign in to comment.