-
Notifications
You must be signed in to change notification settings - Fork 435
Expand file tree
/
Copy pathicp.yaml
More file actions
35 lines (34 loc) · 1.62 KB
/
Copy pathicp.yaml
File metadata and controls
35 lines (34 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
canisters:
- name: backend
build:
steps:
- type: script
commands:
# wasi2ic and wasm-opt are installed on first run if not present.
- which wasi2ic || cargo install wasi2ic
- which wasm-opt || cargo install wasm-opt
# Enable Wasm SIMD instructions for faster Tract inference.
- export RUSTFLAGS="${RUSTFLAGS} -C target-feature=+simd128"
# Compile to wasm32-wasip1 (WASI) so Tract can use POSIX file I/O.
- cargo build --package backend --target wasm32-wasip1 --release
# wasi2ic rewrites WASI syscalls to IC system API calls.
- wasi2ic ./target/wasm32-wasip1/release/backend.wasm "$ICP_WASM_OUTPUT_PATH"
# Optimise the WASM binary size and enable SIMD + bulk-memory proposals.
- wasm-opt -Os --enable-simd --enable-bulk-memory -o "$ICP_WASM_OUTPUT_PATH" "$ICP_WASM_OUTPUT_PATH"
# Embed the Candid interface as public WASM metadata.
- ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "$ICP_WASM_OUTPUT_PATH" metadata candid:service -f backend/backend.did -v public --keep-name-section
sync:
steps:
- type: script
commands:
# Downloads/generates ONNX models and uploads them to the canister.
# Skipped automatically if models are already loaded (e.g. on redeployment).
- bash upload-models-to-canister.sh
- name: frontend
recipe:
type: "@dfinity/static-site@v0.3.1"
configuration:
dir: frontend/dist
build:
- npm install --prefix frontend
- npm run build --prefix frontend