Jelajahi Sumber

Merge pull request #11 from seanyoung/docker

Docker
Sean Young 6 tahun lalu
induk
melakukan
3e025d1f41
3 mengubah file dengan 23 tambahan dan 10 penghapusan
  1. 4 1
      .github/workflows/test.yml
  2. 15 7
      Dockerfile
  3. 4 2
      README.md

+ 4 - 1
.github/workflows/test.yml

@@ -7,8 +7,11 @@ jobs:
 
     steps:
     - name: Install LLVM
-      run: sudo apt-get install llvm-8-dev
+      run: sudo apt-get install llvm-8-dev clang-8
     - uses: actions/checkout@v1
+    - name: Compile stdlib
+      run: clang-8 --target=wasm32 -c -emit-llvm -O3 -ffreestanding -fno-builtin -Wall stdlib.c
+      working-directory:  ./stdlib
     - name: Build
       run: cargo build --verbose
     - name: Run tests

+ 15 - 7
Dockerfile

@@ -1,21 +1,29 @@
-FROM fedora:30 as builder
+# On Alpine linux, the build fails with:
+# error: cannot produce proc-macro for `serde_derive v1.0.102` as the target `x86_64-unknown-linux-musl` does not support these crate types
+# See https://github.com/rust-lang/cargo/issues/5266
+
+# Debian buster does not have llvm 8.
+
+# Fedora 30 produces a builder image 2.01 GiB and solang image of 294 MiB
+
+# Ubuntu 18.04 produces a builder images 1.53 GiB and solang image of 84 MiB
+
+FROM ubuntu:18.04 as builder
 MAINTAINER Sean Young <sean@mess.org>
-# Alpine Linux ships with ancient llvm/clang versions, so we pick Fedora
-# for being much more up to date (8.0). Obviously we could build our own
-# llvm and clang, but that takes ages.
-RUN dnf -y install cargo llvm-static llvm-devel zlib-devel clang glibc-devel.i686
+RUN apt-get update
+RUN apt-get install -y cargo llvm-8-dev clang-8 libz-dev
 
 RUN mkdir -p src/
 COPY . src/
 WORKDIR /src/stdlib/
-RUN clang --target=wasm32 -c -emit-llvm -O3 -fno-builtin -Wall stdlib.c
+RUN clang-8 --target=wasm32 -c -emit-llvm -O3 -ffreestanding -fno-builtin -Wall stdlib.c
 
 WORKDIR /src/
 RUN cargo build --release
 
 # Something more minimal than Fedora would be nice. Alphine won't work
 # since we built solang with glibc, not musl.
-FROM fedora:30
+FROM ubuntu:18.04
 COPY --from=builder /src/target/release/solang /usr/local/bin/solang
 
 ENTRYPOINT ["/usr/local/bin/solang"]

+ 4 - 2
README.md

@@ -1,8 +1,10 @@
-# solang - A new Solidity to wasm compiler written in rust
+# solang - A Solidity to wasm compiler written in rust
+
+[![CI](https://github.com/hyperledger-labs/solang/workflows/test/badge.svg)]
 
 <img align="right" width="400" height="400" src="doc/solang.svg">
 
-This is solang, a new proof of concept
+This is solang, a proof of concept
 [solidity](https://en.wikipedia.org/wiki/Solidity) compiler. The
 [existing solidity compiler](https://solidity.readthedocs.io/) is a huge C++
 code base which implements its own parser, optimizer and handling of binary