提交 f30ccb00 编写于 作者: peterwillcn's avatar peterwillcn 提交者: Nathan Hourt

Adjust standard docker makefile

上级 8b1fbf78
FROM ubuntu
MAINTAINER xiaobo (peterwillcn@gmail.com) # Dapao Xie (wzxiejinbin@me.com edit)
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 \
......@@ -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/*
......@@ -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 \
......@@ -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"]
......@@ -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
# 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
......@@ -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
......@@ -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
#!/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
......@@ -103,6 +103,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册