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 #88 from peterwillcn/master
Browse files Browse the repository at this point in the history
Docker use WASM compiler
  • Loading branch information
bytemaster authored Jul 20, 2017
2 parents 6359b18 + 64e05a9 commit 8bf4f7c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
33 changes: 22 additions & 11 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
FROM ubuntu:xenial-20170619
FROM ubuntu
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
&& DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget 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 \
&& 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 \
clang-4.0 lldb-4.0 lld-4.0 \
&& rm -rf /var/lib/apt/lists/*

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 && 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

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 \
Expand All @@ -23,17 +30,21 @@ RUN cd /tmp && wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_
&& ./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 \
&& cd secp256k1-zkp \
&& ./autogen.sh && ./configure && make && make install \
&& ldconfig && rm -rf /tmp/secp256k1-zkp*

RUN cd /tmp && mkdir wasm-compiler && cd wasm-compiler \
&& git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git \
&& 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 -j$(nproc) install && rm -rf /tmp/wasm-compiler

RUN cd /tmp && git clone https://github.com/EOSIO/eos.git --recursive \
&& touch /tmp/eos/contracts/CMakeLists.txt && cd eos && mkdir build && cd build \
&& cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_STANDARD=14 -DCMAKE_INSTALL_PREFIX=/opt/eos ../ \
&& 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 -j$(nproc) && make install \
&& rm -rf /tmp/eos*

Expand Down
3 changes: 2 additions & 1 deletion Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ Build eos images
```
cd eos/Docker
cp ../genesis.json .
docker build -t eosio/eos .
docker build --rm -t eosio/eos .
```

Start docker

```
sudo rm -rf /data/store/eos # options
sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ Build eos images
```
cd eos/Docker
cp ../genesis.json .
docker build -t eosio/eos .
docker build --rm -t eosio/eos .
```

Start docker

```
sudo rm -rf /data/store/eos # options
sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```
Expand Down
13 changes: 13 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
machine:
services:
- docker

dependencies:
override:
- cd ~/eos/Docker && docker build -t eosio/eos .

test:
pre:
- sleep 5
override:
- docker run eosio/eos

0 comments on commit 8bf4f7c

Please sign in to comment.