File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM --platform=$BUILDPLATFORM rust:1.64 AS buildbase
4
+ WORKDIR /src
5
+ RUN <<EOT bash
6
+ set -ex
7
+ apt-get update
8
+ apt-get install -y \
9
+ git \
10
+ clang
11
+ rustup target add wasm32-wasi
12
+ EOT
13
+ # This line installs WasmEdge including the AOT compiler
14
+ RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash
15
+
16
+ FROM buildbase AS build
17
+ COPY . .
18
+ # Build the Wasm binary
19
+ RUN --mount=type=cache,target=/usr/local/cargo/git/db \
20
+ --mount=type=cache,target=/usr/local/cargo/registry/cache \
21
+ --mount=type=cache,target=/usr/local/cargo/registry/index \
22
+ cargo build --target wasm32-wasi --release
23
+ # This line builds the AOT Wasm binary
24
+ RUN /root/.wasmedge/bin/wasmedgec target/wasm32-wasi/release/order_demo_service.wasm order_demo_service.wasm
25
+
26
+ FROM scratch
27
+ ENTRYPOINT [ "order_demo_service.wasm" ]
28
+ COPY --link --from=build /src/order_demo_service.wasm /order_demo_service.wasm
Original file line number Diff line number Diff line change
1
+ services :
2
+ server :
3
+ image : server
4
+ build :
5
+ context : .
6
+ platforms :
7
+ - wasi/wasm32
8
+ ports :
9
+ - 8080:8080
10
+ network_mode : host
11
+ environment :
12
+ DATABASE_URL : mysql://root:pass@localhost:3306/mysql
13
+ RUST_BACKTRACE : full
14
+ runtime : io.containerd.wasmedge.v1
15
+ db :
16
+ image : mysql:8
17
+ environment :
18
+ MYSQL_ROOT_PASSWORD : pass
19
+ network_mode : host
20
+
You can’t perform that action at this time.
0 commit comments