diff --git a/wasm-base/Dockerfile b/wasm-base/Dockerfile index 303c376..ea81a6b 100644 --- a/wasm-base/Dockerfile +++ b/wasm-base/Dockerfile @@ -10,28 +10,65 @@ RUN apt-get update \ libgcc-11-dev \ lib32gcc-11-dev \ ccache \ + python3-minimal \ + python3-pip \ + ninja-build \ && apt-get clean -# Install WAMR -RUN git clone https://github.com/bytecodealliance/wasm-micro-runtime && cd wasm-micro-runtime \ - && git checkout WAMR-2.4.4 \ - && cd product-mini/platforms/linux \ +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 vmcore +RUN mkdir build && cd build \ + && cmake \ + -DWAMR_BUILD_AOT=1 \ + -DWAMR_BUILD_WAMR_COMPILER=1 \ + -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 +RUN cd wamr-compiler \ + && ./build_llvm.sh \ && mkdir build && cd build \ && cmake .. \ - && make + && make -j$(nproc) + +# Build WAMR iwasm +RUN cd product-mini/platforms/linux \ + && mkdir build && cd build \ + && cmake .. \ + && 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 \ + git \ + ca-certificates \ + wget \ neovim \ + ranger \ wabt \ && apt-get clean -COPY --from=wamr-builder /wasm-micro-runtime/product-mini/platforms/linux/build /opt/wasm-micro-runtime -RUN pwd +COPY --from=wamr-builder /wasm-micro-runtime/build /opt/wamr-vmcore +COPY --from=wamr-builder /wasm-micro-runtime/wamr-compiler/build /opt/wamr-wamrc +COPY --from=wamr-builder /wasm-micro-runtime/product-mini/platforms/linux/build /opt/wamr-iwasm COPY ./examples /home/ubuntu/examples WORKDIR /home/ubuntu/examples -ENV PATH="$PATH:/opt/wasi-sdk/bin:/opt/wasm-micro-runtime" +ENV PATH="$PATH:/opt/wasi-sdk/bin:/opt/wamr-iwasm:/opt/wamr-wamrc"