Cached & remote-ready Rust projects builder by forwarding rustc
calls to BuildKit builders.
cargo-green
is
- a
cargo
plugin that sets a$RUSTC_WRAPPER
then callscargo
. - a
RUSTC_WRAPPER
that builds Dockerfiles
Reads envs
-
$CARGOGREEN_LOG
: sets$RUSTCBUILDX_LOG
level -
$CARGOGREEN_REMOTE
: reserved for now -
$RUSTCBUILDX
-
$RUSTCBUILDX_BASE_IMAGE
-
$RUSTCBUILDX_BUILDER_IMAGE
-
$RUSTCBUILDX_CACHE_IMAGE
-
$RUSTCBUILDX_INCREMENTAL
-
$RUSTCBUILDX_LOG
-
$RUSTCBUILDX_LOG_PATH
-
$RUSTCBUILDX_LOG_STYLE
-
$RUSTCBUILDX_RUNNER
-
$RUSTCBUILDX_RUNS_ON_NETWORK
-
$RUSTCBUILDX_SYNTAX
Sets
- Ensure at least either a
docker
orpodman
client is installed - Known to work on
Ubuntu 22.04
withgit.luolix.top/docker/buildx v0.11.2 9872040
andrust 1.73
cargo green add
cargo green bench
cargo green build
cargo green check
cargo green clean
cargo green clippy
cargo green doc
cargo green init
cargo green install
cargo green new
cargo green package
cargo green publish
cargo green remove
cargo green run
cargo green search
cargo green test
cargo green uninstall
cargo green update
# or, setting an alias in e.g. ~/.bashrc
alias cargo='cargo green'
# With this, one may also use this set of subcommands: [UNSTABLE API] (refacto into a `cache` cmd)
cargo supergreen config get VAR*
cargo supergreen config set VAR VAL
cargo supergreen config unset VAR
cargo supergreen pull-images Pulls latest versions of images used for the build, no cache (respects $DOCKER_HOST)
cargo supergreen pull-cache Pulls all from `--cache-from`
cargo supergreen push-cache Pushes all to `--cache-to`
cargo-green@0.6.0: Cargo plugin and $RUSTC_WRAPPER to sandbox & cache cargo builds and execute jobs remotely
https://github.com/fenollp/supergreen
Usage:
cargo green supergreen env Show used values
cargo green supergreen pull Pulls images (respects $DOCKER_HOST)
cargo green supergreen push Push cache image (all tags)
cargo green supergreen -h | --help
cargo green supergreen -V | --version
Say you have a bigger machine in your ~/.ssh/config
called extra_oomph
:
export DOCKER_HOST=ssh://extra_oomph
cargo green test ...
# Installs to ~/.cargo/bin
cargo install --locked --force --git https://github.com/fenollp/supergreen.git cargo-green
# Make sur $CARGO_HOME/bin is in your $PATH
which cargo-green
-
Proposal: c8d: expose contentstore API #44369 moby/moby#44369
-
Incremental export transfer #1224 moby/buildkit#1224
-
"sending tarball" takes a long time even when the image already exists #107 docker/buildx#107
-
mount=type=cache more in-depth explanation? #1673 moby/buildkit#1673
-
Build drivers https://docs.docker.com/build/drivers/
-
Race condition when using cache-mounts with multi-arch builds. #549 docker/buildx#549
-
https://docs.docker.com/build/ci/github-actions/configure-builder/#max-parallelism
-
https://docs.docker.com/engine/reference/builder/#buildkit-built-in-build-args
-
tunnel tty into a docker build through http
-
docker build
remote
driver https://docs.docker.com/build/drivers/remote -
rootless
k8s
driver https://docs.docker.com/build/drivers/kubernetes/#rootless-mode -
tune many options https://docs.docker.com/build/drivers/docker-container/
-
https://docs.docker.com/build/attestations/sbom/
- https://github.com/moby/buildkit/blob/647a997b389757068760410053873745acabfc80/docs/attestations/sbom.md?plain=1#L48
BUILDKIT_SBOM_SCAN_CONTEXT and BUILDKIT_SBOM_SCAN_STAGE
-
prune
: filtering outADD --checksum=... https://...
entries #2448 -
-o=.
:open $HOME/.local/share/docker/overlay2/066f6../work/work: permission denied
#2219 -
cargo restrict targets of crate
-
Target configuration for binaries #9208 rust-lang/cargo#9208
-
Unsafe fields #3458 rust-lang/rfcs#3458
-
Warning when large binary files are included into the bundle #9058 rust-lang/cargo#9058
-
Hermetic build mode #9506 rust-lang/cargo#9506
-
Consider making the src cache read-only. #9455 rust-lang/cargo#9455
-
Feature Request static asserts #2790 rust-lang/rfcs#2790
-
greater supply chain attack risk due to large dependency trees? https://www.reddit.com/r/rust/comments/102yz60/greater_supply_chain_attack_risk_due_to_large/
-
https://doc.rust-lang.org/rustc/command-line-arguments.html#option-emit
-
[build] rustflags = ["--remap-path-prefix"
-
/r/Rust scare Serde has started shipping precompiled binaries with no way to opt out