|
| 1 | +FROM ubuntu:20.04 |
| 2 | +ARG ARCH |
| 3 | +ENV LD_LIBRARY_PATH=/usr/local/lib |
| 4 | +ENV PATH=/usr/local/bin:$PATH |
| 5 | +CMD ["/bin/bash"] |
| 6 | +ENV DEBIAN_FRONTEND="noninteractive" TZ="America" |
| 7 | +ARG RUST_VERSION="nightly-2023-04-01" |
| 8 | +ARG WASMTIME_REPO="https://github.com/bytecodealliance/wasmtime/" |
| 9 | +ARG WASMTIME_COMMIT="b306368" #v0.38.0 |
| 10 | +ARG SIGHTGLASS_REPO="https://github.com/jlb6740/sightglass.git" |
| 11 | +ARG SIGHTGLASS_BRANCH="add-native-engine" |
| 12 | +ARG SIGHTGLASS_COMMIT="35cccc2" |
| 13 | + |
| 14 | +# Get some prerequisites |
| 15 | +RUN apt-get update \ |
| 16 | + && apt-get install -y --no-install-recommends \ |
| 17 | + apt-utils build-essential gpg-agent \ |
| 18 | + curl ca-certificates wget software-properties-common \ |
| 19 | + psmisc lsof git nano zlib1g-dev libedit-dev time yasm \ |
| 20 | + libssl-dev pkg-config |
| 21 | + |
| 22 | +# Bionic does not carry a recent enough cmake needed for wamr but upgrading |
| 23 | +# to Focal causes other build issues so the straight forward solution is to just |
| 24 | +# install a version of cmake that is recent enough from a separate repository |
| 25 | +RUN wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - |
| 26 | +RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' |
| 27 | +RUN apt-get update && apt-get install --yes cmake |
| 28 | + |
| 29 | +# Install wabt |
| 30 | +WORKDIR /opt |
| 31 | +RUN git clone --recurse-submodules https://github.com/WebAssembly/wabt.git \ |
| 32 | + && cd wabt \ |
| 33 | + && mkdir build \ |
| 34 | + && cd build \ |
| 35 | + && cmake .. \ |
| 36 | + && cmake --build . \ |
| 37 | + && make |
| 38 | +ENV PATH=$PATH:/opt/wabt/bin/ |
| 39 | + |
| 40 | +# Install rust |
| 41 | +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -sSf | sh -s -- --default-toolchain ${RUST_VERSION} -y |
| 42 | +ENV PATH=/root/.cargo/bin:${PATH} |
| 43 | + |
| 44 | +# Install clang |
| 45 | +RUN apt-get install -y --no-install-recommends clang |
| 46 | + |
| 47 | +# Install python |
| 48 | +RUN apt-get install -y --no-install-recommends python3.8 libpython3.8 python3-distutils python3-pip |
| 49 | +RUN python3 -m pip install termgraph \ |
| 50 | + && python3 -m pip install pandas \ |
| 51 | + && python3 -m pip install termcolor \ |
| 52 | + && python3 -m pip install pyyaml |
| 53 | + |
| 54 | +# Install docker |
| 55 | +RUN apt-get update && apt-get -y install ca-certificates curl gnupg lsb-release |
| 56 | +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
| 57 | +RUN echo \ |
| 58 | + "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ |
| 59 | + $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 60 | +RUN apt-get update && apt-get -y install docker-ce docker-ce-cli containerd.io |
| 61 | + |
| 62 | +# Install sightglass |
| 63 | +WORKDIR / |
| 64 | +RUN git clone --recurse-submodules ${SIGHTGLASS_REPO} sightglass |
| 65 | +WORKDIR /sightglass |
| 66 | +RUN git checkout ${SIGHTGLASS_COMMIT} -b ${SIGHTGLASS_COMMIT} |
| 67 | +COPY add_time_metric.diff /sightglass/add_time_metric.diff |
| 68 | +RUN git apply add_time_metric.diff |
| 69 | +RUN cargo build --release |
| 70 | +RUN mkdir results |
| 71 | + |
| 72 | +# Build wasmtime engine for sightglass |
| 73 | +WORKDIR / |
| 74 | +RUN git clone --single-branch --recurse-submodule ${WASMTIME_REPO} wasmtime |
| 75 | +WORKDIR /wasmtime |
| 76 | +RUN git checkout ${WASMTIME_COMMIT} -b ${WASMTIME_COMMIT} |
| 77 | +RUN cargo build -p wasmtime-bench-api --release |
| 78 | +RUN cp target/release/libwasmtime_bench_api.so /sightglass/engines/wasmtime/libengine.so |
| 79 | + |
| 80 | +# Build native engine for sightglass |
| 81 | +WORKDIR /sightglass/engines/native/libengine |
| 82 | +RUN cargo build --release |
| 83 | +RUN cp target/release/libnative_bench_api.so ../libengine.so |
| 84 | + |
| 85 | +# Copy driver/helpers into the image |
| 86 | +WORKDIR / |
| 87 | +COPY wasmscore.py /sightglass/wasmscore.py |
| 88 | +COPY wasmscore.sh / |
0 commit comments