Closed
Description
It would be great to have a way to not run the build command specified in .canisters.<canister name>.build
in dfx.json
when the .canisters.<canister name>.type
is custom
.
This is particularly useful if one wants to only deploy a canister fetched from somewhere, like for instance from a docker build. There are some workarounds, unfortunately none that is very satisfactory:
- Use an environment variable to skip the build in the build command, e.g. deploy with
DFX_NOBUILD=1 dfx deploy ...
and read the value ofDFX_NOBUILD
in the build command and skip the build accordingly. This is a bit hacky and I find it strange for a build script to start withif [[ "${DFX_NOBUILD:-} == "1" ]]; then exit 0; fi
; might as well not run the script. - Use a combination of
dfx canister create
&&dfx canister install
. This is a bit problematic because it needs extra logic to know whether or not to first create the canisters, and what install mode to use (install
,reinstall
,upgrade
).
It would be great if dfx
could support this out of the box. Another possibility would be to decide whether or not to retrigger a build based on timestamps (a la make/cargo/etc) but this would be very tricky since dfx
doesn't know which files are involved in the build.