Skip to content

Installing cargo contract on memory-constrained envs crashes #19

@deuszx

Description

@deuszx

I've found that cargo install --version {cargo_contract_version} cargo-contract can eat up to 16GB of RAM (most likely caused by caching the dependencies in RAM) which is a problem in resource-constraint envs like docker (I'm using colima on MacOS instead of the default docker context and it gets 8GB of RAM by default). This is a problem since no building/packaging can happen with cargo-contract installed and the process fails abruptly with no information about the error cause and cryptic Killed.

The workaround to that problem is to do the following (instead of installing it via cargo install):

  1. In docker cotainer, export https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli CARGO_NET_GIT_FETCH_WITH_CLI=true
  2. Run git clone --depth 1 --branch v2.1.0 <git-link>
  3. cd into cargo-contract.
  4. cargo install --path .

For me, the process was peaking at ~700MB instead of 16GB.

Please test yourself first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions