Skip to content

Commit

Permalink
Support Docker
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Yuan <michael@secondstate.io>
  • Loading branch information
juntao committed Jul 17, 2024
1 parent 09c5f6b commit 85db6e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand All @@ -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
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85db6e7

Please # to comment.