127 lines
3.6 KiB
Docker
127 lines
3.6 KiB
Docker
FROM ubuntu:noble AS wamr-builder
|
|
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive TZ=Europe/Berline apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
gcc-multilib \
|
|
g++-multilib \
|
|
libgcc-11-dev \
|
|
lib32gcc-11-dev \
|
|
libc6-dev-i386 \
|
|
busybox \
|
|
git \
|
|
ca-certificates \
|
|
cmake \
|
|
ccache \
|
|
python3-minimal \
|
|
python3-pip \
|
|
ninja-build \
|
|
&& apt-get clean
|
|
|
|
RUN python3 -m pip config set global.break-system-packages true
|
|
|
|
# Clone WAMR
|
|
RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime \
|
|
&& cd wasm-micro-runtime \
|
|
&& git checkout WAMR-2.4.4
|
|
WORKDIR /wasm-micro-runtime
|
|
|
|
# Build WAMR iwasm (vmcore standalone interpreter)
|
|
RUN cd product-mini/platforms/linux \
|
|
&& mkdir build_iwasm && cd build_iwasm \
|
|
&& cmake \
|
|
-DWAMR_BUILD_PLATFORM=linux \
|
|
-DWAMR_BUILD_TARGET=X86_64 \
|
|
-DWAMR_BUILD_AOT=0 \
|
|
-DWAMR_BUILD_WAMR_COMPILER=0 \
|
|
-DWAMR_BUILD_INTERP=1 \
|
|
-DWAMR_BUILD_FAST_INTERP=0 \
|
|
-DWAMR_BUILD_JIT=0 \
|
|
-DWAMR_BUILD_FAST_JIT=0 \
|
|
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
|
-DWAMR_BUILD_LIBC_WASI=1 \
|
|
.. \
|
|
&& make -j$(nproc)
|
|
|
|
# Build WAMR wamrc (standalone compiler)
|
|
RUN cd wamr-compiler \
|
|
&& ./build_llvm.sh \
|
|
&& mkdir build_wamrc && cd build_wamrc \
|
|
&& cmake \
|
|
-DWAMR_BUILD_PLATFORM=linux \
|
|
-DWAMR_BUILD_TARGET=X86_64 \
|
|
-DWAMR_BUILD_AOT=0 \
|
|
-DWAMR_BUILD_WAMR_COMPILER=1 \
|
|
-DWAMR_BUILD_INTERP=0 \
|
|
-DWAMR_BUILD_FAST_INTERP=0 \
|
|
-DWAMR_BUILD_JIT=0 \
|
|
-DWAMR_BUILD_FAST_JIT=0 \
|
|
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
|
-DWAMR_BUILD_LIBC_WASI=1 \
|
|
.. \
|
|
&& make -j$(nproc)
|
|
|
|
# Build WAMR libvmlib (compiler runtime - to compile wasm modules embedded in a native application)
|
|
RUN cd wamr-compiler \
|
|
&& ./build_llvm.sh \
|
|
# && ./build_llvm.sh --extra-cmake-flags "-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_EXE_LINKER_FLAGS=-m32 -lstdc++" \
|
|
&& mkdir build_libvmlib && cd build_libvmlib \
|
|
&& cmake \
|
|
-DWAMR_BUILD_PLATFORM=linux \
|
|
-DWAMR_BUILD_TARGET=X86_64 \
|
|
-DWAMR_BUILD_AOT=1 \
|
|
-DWAMR_BUILD_WAMR_COMPILER=0 \
|
|
-DWAMR_BUILD_INTERP=0 \
|
|
-DWAMR_BUILD_FAST_INTERP=0 \
|
|
-DWAMR_BUILD_JIT=0 \
|
|
-DWAMR_BUILD_FAST_JIT=0 \
|
|
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
|
-DWAMR_BUILD_LIBC_WASI=0 \
|
|
.. \
|
|
&& make -j$(nproc)
|
|
|
|
# Build WAMR libiwasm (vmcore interpreter runtime - to run wasm modules embedded in a native application)
|
|
RUN mkdir build_libiwasm && cd build_libiwasm \
|
|
&& cmake \
|
|
-DWAMR_BUILD_PLATFORM=linux \
|
|
-DWAMR_BUILD_TARGET=X86_64 \
|
|
-DWAMR_BUILD_AOT=1 \
|
|
-DWAMR_BUILD_WAMR_COMPILER=0 \
|
|
-DWAMR_BUILD_INTERP=1 \
|
|
-DWAMR_BUILD_FAST_INTERP=0 \
|
|
-DWAMR_BUILD_JIT=0 \
|
|
-DWAMR_BUILD_FAST_JIT=0 \
|
|
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
|
-DWAMR_BUILD_LIBC_WASI=0 \
|
|
.. \
|
|
&& make -j$(nproc)
|
|
|
|
# =============================================================================
|
|
|
|
FROM ghcr.io/webassembly/wasi-sdk:wasi-sdk-29
|
|
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive TZ=Europe/Berline apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
gcc-multilib \
|
|
busybox \
|
|
git \
|
|
ca-certificates \
|
|
wget \
|
|
neovim \
|
|
ranger \
|
|
wabt \
|
|
fish \
|
|
&& apt-get clean
|
|
|
|
COPY --from=wamr-builder /wasm-micro-runtime /opt/wamr
|
|
RUN ln -sf /opt/wamr/product-mini/platforms/linux/build_iwasm /opt/wamr-iwasm \
|
|
&& ln -sf /opt/wamr/build_libiwasm /opt/wamr-libiwasm \
|
|
&& ln -sf /opt/wamr/wamr-compiler/build_wamrc /opt/wamr-wamrc \
|
|
&& ln -sf /opt/wamr/wamr-compiler/build_libvmlib /opt/wamr-libvmlib
|
|
|
|
COPY ./examples /home/ubuntu/examples
|
|
WORKDIR /home/ubuntu/examples
|
|
|
|
ENV PATH="$PATH:/opt/wasi-sdk/bin:/opt/wamr-iwasm:/opt/wamr-wamrc"
|