Skip to content

Configuration Reference

Complete reference for icp.yaml project configuration.

For conceptual explanation, see Project Model.

File Structure

icp.yaml
canisters:
- # canister definitions or references
networks:
- # network definitions or references (optional)
environments:
- # environment definitions (optional)

Canisters

Inline Definition

canisters:
- name: my-canister
build:
steps:
- type: script
commands:
- echo "Building..."
sync:
steps:
- type: assets
dir: www
settings:
compute_allocation: 5
init_args: "()"

External Reference

canisters:
- path/to/canister.yaml
- canisters/* # Glob pattern
- services/**/*.yaml # Recursive glob

Canister Properties

PropertyTypeRequiredDescription
namestringYesUnique canister identifier
buildobjectYesBuild configuration
syncobjectNoPost-deployment sync configuration
settingsobjectNoCanister settings
init_argsstringNoInitialization arguments (Candid or hex)
recipeobjectNoRecipe reference (alternative to build)

Build Steps

Script Step

Execute shell commands:

build:
steps:
- type: script
commands:
- cargo build --target wasm32-unknown-unknown --release
- cp target/wasm32-unknown-unknown/release/my_canister.wasm "$ICP_WASM_OUTPUT_PATH"

Environment variables:

  • ICP_WASM_OUTPUT_PATH — Target path for WASM output
  • ICP_PROJECT_ROOT — Project root directory

Pre-built Step

Use existing WASM:

build:
steps:
- type: pre-built
path: dist/canister.wasm
sha256: abc123... # Optional integrity check
PropertyTypeRequiredDescription
pathstringYesPath to WASM file
sha256stringNoSHA256 hash for verification

Sync Steps

Assets Sync

Upload files to asset canister:

sync:
steps:
- type: assets
dir: dist

Recipes

Recipe Reference

canisters:
- name: my-canister
recipe:
type: "@dfinity/rust"
sha256: abc123... # Required for remote URLs
configuration:
package: my-crate
PropertyTypeRequiredDescription
typestringYesRecipe source (registry, URL, or local path)
sha256stringConditionalRequired for remote URLs
configurationobjectNoParameters passed to recipe template

Recipe Type Formats

# Registry (recommended)
type: "@dfinity/rust"
type: "@dfinity/rust@v1.0.0" # With version
# Local file
type: ./recipes/my-recipe.hb.yaml
# Remote URL
type: https://example.com/recipe.hb.yaml

Networks

Managed Network

networks:
- name: local-dev
mode: managed
gateway:
host: 127.0.0.1
port: 4943
PropertyTypeRequiredDescription
namestringYesNetwork identifier
modestringYesmanaged
gateway.hoststringNoHost address (default: 127.0.0.1)
gateway.portintegerNoPort number (default: 8000)

Connected Network

networks:
- name: testnet
mode: connected
url: https://testnet.ic0.app
root-key: <hex-encoded-key> # For non-mainnet
PropertyTypeRequiredDescription
namestringYesNetwork identifier
modestringYesconnected
urlstringYesNetwork endpoint URL
root-keystringNoHex-encoded root key (non-mainnet only)

Docker Network

networks:
- name: docker-local
mode: managed
image: ghcr.io/dfinity/icp-cli-network-launcher
port-mapping:
- "0:4943"

See Containerized Networks for full options.

Environments

environments:
- name: staging
network: ic
canisters:
- frontend
- backend
settings:
frontend:
memory_allocation: 2147483648
backend:
compute_allocation: 10
environment_variables:
LOG_LEVEL: "info"
init_args:
backend: "(record { mode = \"staging\" })"
PropertyTypeRequiredDescription
namestringYesEnvironment identifier
networkstringYesNetwork to deploy to
canistersarrayNoCanisters to include (default: all)
settingsobjectNoPer-canister setting overrides
init_argsobjectNoPer-canister init arg overrides

Canister Settings

See Canister Settings Reference for all options.

settings:
compute_allocation: 5
memory_allocation: 4294967296
freezing_threshold: 2592000
reserved_cycles_limit: 1000000000000
wasm_memory_limit: 1073741824
wasm_memory_threshold: 536870912
log_visibility: controllers
environment_variables:
KEY: "value"

Init Args

Candid text format:

init_args: "(record { owner = principal \"aaaaa-aa\" })"

Hex-encoded bytes:

init_args: "4449444c016d7b0100010203"

Implicit Defaults

Networks

NameModeDescription
localmanagedlocalhost:8000, can be overridden
icconnectedICP mainnet, cannot be overridden

Environments

NameNetworkCanisters
locallocalAll
icicAll

Complete Example

canisters:
- name: frontend
recipe:
type: "@dfinity/asset-canister"
configuration:
dir: dist
settings:
memory_allocation: 1073741824
- name: backend
build:
steps:
- type: script
commands:
- cargo build --target wasm32-unknown-unknown --release
- cp target/wasm32-unknown-unknown/release/backend.wasm "$ICP_WASM_OUTPUT_PATH"
settings:
compute_allocation: 5
init_args: "(record { admin = principal \"aaaaa-aa\" })"
networks:
- name: local
mode: managed
gateway:
port: 9999
environments:
- name: staging
network: ic
canisters: [frontend, backend]
settings:
backend:
compute_allocation: 10
environment_variables:
ENV: "staging"
- name: production
network: ic
canisters: [frontend, backend]
settings:
frontend:
memory_allocation: 4294967296
backend:
compute_allocation: 30
freezing_threshold: 7776000
environment_variables:
ENV: "production"
init_args:
backend: "(record { admin = principal \"xxxx-xxxx\" })"

Schema

JSON schemas for editor integration are available in docs/schemas/:

Configure your editor to use them for autocomplete and validation:

# yaml-language-server: $schema=https://raw.githubusercontent.com/dfinity/icp-cli/main/docs/schemas/icp-yaml-schema.json
canisters:
- name: my-canister
# ...