Created
June 12, 2023 16:33
-
-
Save dipankardas011/893f16d01cebfb2a0fd66a796c7646d5 to your computer and use it in GitHub Desktop.
Wasi dockerfile for rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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