-
Notifications
You must be signed in to change notification settings - Fork 995
/
Dockerfile
40 lines (35 loc) · 1.51 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM ubuntu:20.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
clang \
curl \
git \
libc6-dev \
make \
xz-utils
# Note that we're using `git reset --hard` to pin to a specific commit for
# verification for now. The sysroot is currently in somewhat of a state of flux
# and is expected to have breaking changes, so this is an attempt to mitigate
# those breaking changes on `libc`'s own CI
RUN git clone https://github.com/WebAssembly/wasi-libc && \
cd wasi-libc && \
git reset --hard f2e779e5f1ba4a539937cedeeaa762c1e0c162df
RUN apt-get install -y --no-install-recommends llvm
RUN make -C wasi-libc install -j $(nproc) INSTALL_DIR=/wasi-libc
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | \
tar xJf -
ENV PATH=$PATH:/wasmtime-dev-x86_64-linux
COPY docker/wasm32-wasi/clang.sh /wasi-libc/bin/clang
RUN apt-get install -y --no-install-recommends lld
RUN ln -s /usr/bin/wasm-ld-10 /usr/bin/wasm-ld
ENV PATH=$PATH:/usr/lib/llvm-9/bin
# Of note here is our clang wrapper which just executes a normal clang
# executable with the right sysroot, and then we're sure to turn off the
# crt-static feature to ensure that the CRT that we're specifying with `clang`
# is used.
ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \
CARGO_TARGET_WASM32_WASI_LINKER=/wasi-libc/bin/clang \
CC_wasm32_wasi=/wasi-libc/bin/clang \
PATH=$PATH:/rust/bin \
RUSTFLAGS='-Ctarget-feature=-crt-static -Clink-args=-Wl,-v'