The sfdx-project.json contains a list of packages on which your packages depends, and there are scripts available to perform installation of dependencies such as the one available here:
- https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_install_pkg_sample_script.htm
- https://medium.com/salesforce-dev-cafe/sfdx-create-a-complex-dev-org-with-one-line-in-terminal-52cfa530f0be
However, while the first script requires that your code is already released as a package (and it will use a SOQL query to determine the dependency of your package) the second script requires you to specify the packageID you depend on as an environment variable.
Since those packages ids are specified in your sfdx-project.json, isn't there an sfdx command to install those packages, providing a list of installation keys?