From 85db6e7c7d06e96786d8d364f5869d1860c3c026 Mon Sep 17 00:00:00 2001 From: Michael Yuan Date: Wed, 17 Jul 2024 03:13:32 +0000 Subject: [PATCH] Support Docker Signed-off-by: Michael Yuan --- Dockerfile | 10 +++++----- docker-compose.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index d57aeea..e853e60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,21 +7,21 @@ COPY client/ /src RUN --mount=type=cache,target=/usr/local/cargo/git/db \ --mount=type=cache,target=/usr/local/cargo/registry/cache \ --mount=type=cache,target=/usr/local/cargo/registry/index \ - cargo build --target wasm32-wasi --release + RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release FROM --platform=$BUILDPLATFORM buildbase AS buildserver COPY server/ /src RUN --mount=type=cache,target=/usr/local/cargo/git/db \ --mount=type=cache,target=/usr/local/cargo/registry/cache \ --mount=type=cache,target=/usr/local/cargo/registry/index \ - cargo build --target wasm32-wasi --release + RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release FROM --platform=$BUILDPLATFORM buildbase AS buildserverwarp -COPY server-warp/ /src +COPY server-axum/ /src RUN --mount=type=cache,target=/usr/local/cargo/git/db \ --mount=type=cache,target=/usr/local/cargo/registry/cache \ --mount=type=cache,target=/usr/local/cargo/registry/index \ - cargo build --target wasm32-wasi --release + RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release FROM scratch AS client ENTRYPOINT [ "wasmedge_hyper_client.wasm" ] @@ -33,4 +33,4 @@ COPY --link --from=buildserver /src/target/wasm32-wasi/release/wasmedge_hyper_se FROM scratch AS server-warp ENTRYPOINT [ "wasmedge_warp_server.wasm" ] -COPY --link --from=buildserverwarp /src/target/wasm32-wasi/release/wasmedge_warp_server.wasm wasmedge_warp_server.wasm +COPY --link --from=buildserverwarp /src/target/wasm32-wasi/release/wasmedge_axum_server.wasm wasmedge_axum_server.wasm diff --git a/docker-compose.yml b/docker-compose.yml index 49feebe..9b755ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,12 +8,12 @@ services: runtime: io.containerd.wasmedge.v1 ports: - 8080:8080 - server-warp: # docker compose run --no-TTY -p 8080:8080 server-warp - image: demo-server-warp + server-warp: # docker compose run --no-TTY -p 8080:8080 server-axum + image: demo-server-axum platform: wasi/wasm build: context: . - target: server-warp + target: server-axum runtime: io.containerd.wasmedge.v1 ports: - 8080:8080