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

Adjust standard docker makefile #124

Merged
merged 3 commits into from
Aug 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ addons:
- clang-4.0
- g++-6
- ninja-build
- libgmp-dev
before_install:
- mkdir ext && cd ext
- wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2 && tar xjf boost_1_64_0.tar.bz2
Expand All @@ -25,4 +26,3 @@ script:
- WASM_LLVM_CONFIG=$TRAVIS_BUILD_DIR/ext/wasm-compiler/bin/llvm-config ext/cmake-3.9.0-Linux-x86_64/bin/cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++-4.0 -DCMAKE_C_COMPILER=clang-4.0 -DBOOST_ROOT=$TRAVIS_BUILD_DIR/ext -DSecp256k1_ROOT_DIR=$TRAVIS_BUILD_DIR/ext
- ninja -j4
- tests/chain_test
- tests/slow_test
24 changes: 8 additions & 16 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ubuntu
MAINTAINER xiaobo ([email protected]) # Dapao Xie ([email protected] edit)
MAINTAINER xiaobo ([email protected])

RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \
&& echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \
Expand All @@ -10,7 +10,7 @@ RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /et
&& 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 build-essential pkg-config libtool \
mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev \
mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev libgmp-dev \
clang-4.0 lldb-4.0 lld-4.0 \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -20,7 +20,7 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/cla
RUN cd /tmp && wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh \
&& mkdir /opt/cmake && chmod +x /tmp/cmake-3.9.0-Linux-x86_64.sh \
&& sh /tmp/cmake-3.9.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license \
&& ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
&& ln -s /opt/cmake/bin/cmake /usr/local/bin

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 \
Expand All @@ -40,26 +40,18 @@ RUN cd /tmp && mkdir wasm-compiler && cd wasm-compiler \
&& cd llvm/tools && git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git \
&& cd .. && mkdir build && cd build \
&& cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ \
&& make -j2 install && rm -rf /tmp/wasm-compiler

RUN cd /tmp && wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2 \
&& tar -xvf gmp-6.1.2.tar.bz2 && cd gmp-6.1.2 \
&& ./configure && make && sudo make install \
&& make check \
&& rm -rf /tmp/gmp-6.1.2

RUN mkdir -p /opt/eos/bin/data-dir
&& make -j$(nproc) install && rm -rf /tmp/wasm-compiler

RUN cd /tmp && git clone https://github.com/EOSIO/eos.git --recursive \
&& cd eos && mkdir build && cd build \
&& mkdir -p /opt/eos/bin/data-dir && cd eos && mkdir build && cd build \
&& WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ../ \
&& make -j2 && make install \
&& cp -a ../contracts /opt/eos/contracts \
&& make -j$(nproc) && make install && mv ../contracts / \
&& ln -s /opt/eos/bin/eos* /usr/local/bin \
&& rm -rf /tmp/eos*

COPY config.ini genesis.json /
COPY entrypoint.sh /sbin
RUN cd /opt/eos/bin && chmod +x /sbin/entrypoint.sh
RUN chmod +x /sbin/entrypoint.sh
VOLUME /opt/eos/bin/data-dir
EXPOSE 9876 8888
ENTRYPOINT ["/sbin/entrypoint.sh"]
11 changes: 11 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```

Run example contracts

```
cd /data/store/eos/contracts/exchange
docker exec docker_eos_1 eosc setcode exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi

cd /data/store/eos/contracts/currency
docker exec docker_eos_1 eosc setcode currency contracts/currency/currency.wast contracts/currency/currency.abi

```

Done
15 changes: 8 additions & 7 deletions Docker/config.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# File to read Genesis State from
# genesis-json =
genesis-json = "/opt/eos/bin/data-dir/genesis.json"
# 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 =
# checkpoint =

# open the database in read only mode
readonly = 0
Expand All @@ -24,19 +24,19 @@ http-server-endpoint = 127.0.0.1:8888
listen-endpoint = 127.0.0.1:9876

# The IP address and port of a remote peer to sync with.
# remote-endpoint =
# 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
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. "inita", quotes are required, may specify multiple times)
# producer-name =
# producer-name =
producer-name = inita
producer-name = initb
producer-name = initc
Expand All @@ -63,7 +63,8 @@ producer-name = initu
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]

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

plugin = eos::producer_plugin
plugin = eos::chain_api_plugin
plugin = eos::http_plugin
13 changes: 9 additions & 4 deletions Docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#!/bin/sh
cd /opt/eos/bin

if [ -f '/opt/eos/bin/data-dir/config.ini' ]
then
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

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

if [ -d '/opt/eos/bin/data-dir/contracts' ]; then
echo
else
cp -r /contracts /opt/eos/bin/data-dir
fi

exec /opt/eos/bin/eosd
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Eos

[![Build Status](https://travis-ci.org/EOSIO/eos.svg?branch=master)](https://travis-ci.org/EOSIO/eos)

Welcome to the EOS.IO source code repository!

## Getting Started
Expand Down Expand Up @@ -103,6 +105,17 @@ sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```

Run example contracts

```
cd /data/store/eos/contracts/exchange
docker exec docker_eos_1 eosc setcode exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi

cd /data/store/eos/contracts/currency
docker exec docker_eos_1 eosc setcode currency contracts/currency/currency.wast contracts/currency/currency.abi

```

Done


Expand Down