Dfx deploy with gzip


Just to piggyback on this dfx deploy with gzip · Issue #2357 · dfinity/sdk · GitHub

I want to use gzip for our canisters because the massive size.

From my tests I was able to successfully gzip my test canister through dfx build and the installed wasm is around 2.5x-2.8x smaller in size.

This is how: motoko-test/dfx.json at main · gabrielnic/motoko-test · GitHub and motoko-test/compress.sh at main · gabrielnic/motoko-test · GitHub

Now my question is: is this the best way to do it?

The issue with this is I still have to “manually” create the wasm and the did files. I don’t have a problem with that but I’m wondering if there’s a better way. For reference I use motoko.

cc: @claudio

1 Like

Until we make dfx auto-gzip wasms this is probably the way to go. Here’s how some other people are doing it, which may be a bit simpler, but doesn’t work with dfx deploy: BUG: Since upgrading to dfx v0.12, running into "Failed to install wasm. The replica returned an HTTP Error: Http Error: status 413 Payload Too Large" - #18 by saikatdas0790


Ah yes, I’m aware of that, but the biggest issue is we have a lot of factories so we’ll still have to run the manual gzip for a lot of canisters and we’ll end up having a bash script.

Thank you for your input, we can use this for now until auto-gzip is enabled.