-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7d4ffc3
Showing
14 changed files
with
1,936 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
*.iml | ||
.idea |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#docker build --platform=linux/arm64 -f Dockerfile.embed -t wasm-kubernetes:embed . | ||
FROM --platform=$BUILDPLATFORM rust:1.84-slim AS build | ||
|
||
RUN <<EOT bash | ||
set -ex | ||
apt-get update | ||
apt-get install -y git clang | ||
rustup target add wasm32-wasip1 | ||
EOT | ||
|
||
WORKDIR /wasm | ||
|
||
COPY wasm/Cargo.toml Cargo.toml | ||
|
||
WORKDIR / | ||
|
||
COPY src src | ||
|
||
WORKDIR /wasm | ||
|
||
RUN RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release | ||
|
||
FROM --platform=$BUILDPLATFORM wasmedge/slim-runtime:0.13.5 | ||
|
||
COPY --from=build /wasm/target/wasm32-wasip1/release/httpbin.wasm /httpbin.wasm | ||
|
||
CMD ["wasmedge", "--dir", ".:/", "/httpbin.wasm"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#docker build -f Dockerfile.native -t wasm-kubernetes:native . | ||
FROM rust:1.84-slim AS build | ||
|
||
RUN <<EOB | ||
|
||
apt-get update | ||
apt-get install -y musl-tools musl-dev | ||
rustup target add aarch64-unknown-linux-musl | ||
|
||
EOB | ||
|
||
WORKDIR /native | ||
|
||
COPY native/Cargo.toml Cargo.toml | ||
|
||
WORKDIR / | ||
|
||
COPY src src | ||
|
||
WORKDIR /native | ||
|
||
RUN RUSTFLAGS="-C target-feature=+crt-static" cargo build --target aarch64-unknown-linux-musl --release | ||
|
||
FROM gcr.io/distroless/static | ||
|
||
COPY --from=build /native/target/aarch64-unknown-linux-musl/release/httpbin httpbin | ||
|
||
ENTRYPOINT ["./httpbin"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#docker build --platform=wasi/wasm,linux/arm64 -f Dockerfile.runtime -t wasm-kubernetes:runtime . | ||
FROM --platform=$BUILDPLATFORM rust:1.84-slim AS build | ||
|
||
RUN <<EOT bash | ||
set -ex | ||
apt-get update | ||
apt-get install -y git clang | ||
rustup target add wasm32-wasip1 | ||
EOT | ||
|
||
WORKDIR /wasm | ||
|
||
COPY wasm/Cargo.toml Cargo.toml | ||
|
||
WORKDIR / | ||
|
||
COPY src src | ||
|
||
WORKDIR /wasm | ||
|
||
RUN RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release | ||
|
||
FROM scratch | ||
|
||
COPY --from=build /wasm/target/wasm32-wasip1/release/httpbin.wasm /httpbin.wasm | ||
|
||
ENTRYPOINT ["/httpbin.wasm"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
docker build -f Dockerfile.native -t wasm-kubernetes:native . | ||
docker build --platform=linux/arm64 -f Dockerfile.embed -t wasm-kubernetes:embed . | ||
docker build --platform=wasi/wasm,linux/arm64 -f Dockerfile.runtime -t wasm-kubernetes:runtime . |
Empty file.
Oops, something went wrong.