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

Docker use WASM compiler #88

Merged
merged 1 commit into from
Jul 20, 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
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 ([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 \
&& 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