-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
91 lines (79 loc) · 3.12 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
FROM ubuntu:20.04
ARG ARCH
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PATH=/usr/local/bin:$PATH
CMD ["/bin/bash"]
ENV DEBIAN_FRONTEND="noninteractive" TZ="America"
ARG RUST_VERSION="nightly-2024-06-09"
ARG WASMTIME_REPO="https://github.com/bytecodealliance/wasmtime/"
ARG WASMTIME_COMMIT="cedf9aa" # v21.0.1
ARG SIGHTGLASS_REPO="https://github.com/bytecodealliance/sightglass.git"
ARG SIGHTGLASS_BRANCH="main"
ARG SIGHTGLASS_COMMIT="e89fce0"
# Get some prerequisites
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils build-essential gpg-agent \
curl ca-certificates wget software-properties-common \
psmisc lsof git nano zlib1g-dev libedit-dev time yasm \
libssl-dev pkg-config
# Bionic does not carry a recent enough cmake needed for wamr but upgrading
# to Focal causes other build issues so the straight forward solution is to just
# install a version of cmake that is recent enough from a separate repository
RUN wget -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add -
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
RUN apt-get update && apt-get install --yes cmake
# Install wabt
WORKDIR /opt
RUN git clone --recurse-submodules https://github.com/WebAssembly/wabt.git \
&& cd wabt \
&& mkdir build \
&& cd build \
&& cmake .. \
&& cmake --build . \
&& make
ENV PATH=$PATH:/opt/wabt/bin/
# Install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -sSf | sh -s -- --default-toolchain ${RUST_VERSION} -y
ENV PATH=/root/.cargo/bin:${PATH}
# Install clang
RUN apt-get install -y --no-install-recommends clang
# Install python
RUN apt-get install -y --no-install-recommends python3.8 libpython3.8 python3-distutils python3-pip
RUN python3 -m pip install termgraph \
&& python3 -m pip install pandas \
&& python3 -m pip install termcolor \
&& python3 -m pip install pyyaml
# Install sightglass
WORKDIR /
RUN git clone --recurse-submodules ${SIGHTGLASS_REPO} sightglass
WORKDIR /sightglass
RUN git checkout ${SIGHTGLASS_COMMIT} -b ${SIGHTGLASS_COMMIT}
COPY add_time_metric.diff /sightglass/add_time_metric.diff
RUN git apply add_time_metric.diff
RUN cargo build --release
RUN mkdir results
# Build wasmtime engine for sightglass
WORKDIR /
RUN git clone --recurse-submodule ${WASMTIME_REPO} wasmtime
WORKDIR /wasmtime
RUN git checkout ${WASMTIME_COMMIT} -b ${WASMTIME_COMMIT}
RUN git submodule update --init --recursive
RUN cargo build -p wasmtime-bench-api --release
RUN cp target/release/libwasmtime_bench_api.so /sightglass/engines/wasmtime/libengine.so
# Build native engine for sightglass
WORKDIR /sightglass/engines/native/libengine
RUN cargo build --release
RUN cp target/release/libnative_bench_api.so ../libengine.so
# Replace sightglass benchmarks folder with custom version
WORKDIR /
RUN rm -rf /sightglass/benchmarks
ADD benchmarks /sightglass/benchmarks
# Copy driver/helpers into the image
WORKDIR /
COPY wasmscore.sh /
COPY wasmscore.py /sightglass/wasmscore.py
COPY add_time_metric.diff build.sh requirements.txt Dockerfile wasmscore.py config.inc /sightglass/
# Set default entry and command
ENTRYPOINT ["/bin/bash", "/wasmscore.sh"]
CMD ["-t", "wasmscore"]