You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- save crates to the correct deps/cargo path.
- add .cargo/config.toml as project file
- format crates as a folder with sha's for compatibility with cargo
vendor (and thus removing the need to use crates indexes)
cachi2 fetch-deps --source bat '{"type": "cargo"}'
511
511
```
512
512
513
513
### Generate environment variables (cargo)
514
514
515
-
#### Alternative crates.io
516
-
Cargo must be configured differently when crates.io will be replaced with an alternative registry to crates.io (or at least similar way - something that the [cargo plugin for nexus](https://github.com/sonatype-nexus-community/nexus-repository-cargo) seems to handle) or from a local path.
515
+
At the moment no env var is generated for cargo, but let's do this step for compatibility
516
+
with other integrations.
517
517
518
-
For enabling an alternative crates.io registry the only required env is
2023-10-18 14:51:01,936 INFO Creating /tmp/playground/pure-rust/bat/.cargo/config.toml
527
+
```
525
528
526
-
Unfortunately I'm still clueless on how to run an alternative registry (and this don't seem to align with cachi2 ethos), so I'm skipping this option.
529
+
### Build the base image (cargo)
527
530
528
-
#### Replacing crates.io with a local path
529
531
530
-
TLDR: not possible through environment variables; will need to inject a config file to a specific location
532
+
Containerfile.baseimage
533
+
```Dockerfile
534
+
FROM registry.access.redhat.com/ubi9/ubi
531
535
532
-
Unfortunately this method does not work with environment variables (see [this cargo issue](https://github.com/rust-lang/cargo/issues/5416)) and requires a .cargo/config.toml file.
536
+
RUN dnf install cargo rust rust-std-static -y &&\
537
+
dnf clean all
538
+
```
533
539
534
-
It must be placed somewhere relative to where "cargo install/build" will run following the hierarchical structure below
>Cargo allows local configuration for a particular package as well as global configuration. It looks for configuration files in the current directory and all parent directories. If, for example, Cargo were invoked in `/projects/foo/bar/baz`, then the following configuration files would be probed for and unified in this order:
local-registry also requires a index of all packages downloaded exactly like what's in https://github.com/rust-lang/crates.io-index. For this POC I just git cloned this repo locally and placed it at `./cachi2-output/index` (NOTE: this is definitely overkill; the final version should use only indexes for the packages we have)
There's a [cargo local registry package](https://crates.io/crates/cargo-local-registry) that prepares dependencies like this, but it is pretty buggy and fails for some packages I played around (including the one used on this PoC).
0 commit comments