Skip to content

Instantly share code, notes, and snippets.

@dipankardas011
Created June 12, 2023 16:33
Show Gist options
  • Save dipankardas011/893f16d01cebfb2a0fd66a796c7646d5 to your computer and use it in GitHub Desktop.
Save dipankardas011/893f16d01cebfb2a0fd66a796c7646d5 to your computer and use it in GitHub Desktop.
Wasi dockerfile for rust
FROM --platform=$BUILDPLATFORM rust:1.64 AS buildbase
WORKDIR /src
RUN <<EOT bash
set -ex
apt-get update
apt-get install -y git clang
rustup target add wasm32-wasi
EOT
FROM buildbase AS build
COPY Cargo.toml .
COPY src ./src
# build the wasm binary
RUN cargo build --target wasm32-wasi --release
FROM scratch
COPY --link --from=build /src/target/wasm32-wasi/release/<WASM_FILE_NAME> /<WASM_FILE_NAME>
ENTRYPOINT [ "<WASM_FILE_NAME>" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment