Assets canisters in local network

How to use the assets files, like images in deveploment network

1 Like

you need to define the “assets” canister in dfx.json file. For example :

“icevent_assets”: {
“dependencies”: [
“icevent”
],
“frontend”: {
“entrypoint”: “src/icevent_assets/src/index.html”
},
“source”: [
“src/icevent_assets/assets”,
“dist/icevent_assets/”
],
“type”: “assets”
}

in the source folder, you can put any assets as normal webapps

1 Like

Thanks for answer, but i don’t know was how to use the images in assets canister.
In IC network, set the img src to " https://<CANISTER_ID>.raw.ic0.app/1.png",
What i should do in Local network

1 Like

You need to install icx-proxy from the agent-rs repo.

Then, run something like this:

icx-proxy --address 192.168.1.67:8000 --replica http://localhost:$(cat ~/<your home dir>/.dfx/replica-configuration/replica-1.port) --dns-alias 192.168.1.67:rkp4c-7iaaa-aaaaa-aaaca-cai -v -v

Make sure you run dfx replica as well.

Then, replace the IP address, canister ID, and with your own, and call https://192.168.1.67:8000/<asset name>.

3 Likes

Thanks, i will give it a try