6 个版本 (破坏性更新)
新版本 0.8.0 | 2024年8月19日 |
---|---|
0.6.0 | 2024年8月17日 |
0.5.0 | 2024年8月16日 |
0.4.0 | 2024年6月23日 |
0.2.0 | 2024年5月11日 |
#17 in 缓存
每月下载量 381
145KB
2.5K SLoC
cargo-green
通过将 rustc
调用转发到 BuildKit 构建器来缓存和准备远程就绪的 Rust 项目构建器。
cargo-green
是
- 一个
cargo
插件,它设置$RUSTC_WRAPPER
然后调用cargo
。 - 一个构建 Dockerfile 的
RUSTC_WRAPPER
工具
配置
读取环境变量
-
$CARGOGREEN_LOG
:设置$RUSTCBUILDX_LOG
级别 -
$CARGOGREEN_REMOTE
:目前保留 -
$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
设置
用法
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`
调整设置
[email protected]: 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
远程执行
假设你在~/.ssh/config
中有一个名为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
En vrac
-
提议:c8d:公开contentstore API #44369 https://github.com/moby/moby/issues/44369
-
增量导出传输 #1224 https://github.com/moby/buildkit/issues/1224
-
"发送tar包"即使镜像已存在也需要很长时间 #107 https://github.com/docker/buildx/issues/107
-
mount=type=cache 更深入的解释? #1673 https://github.com/moby/buildkit/issues/1673
-
使用缓存挂载和多架构构建时的竞争条件 #549 https://github.com/docker/buildx/issues/549
-
https://docs.docker.net.cn/build/ci/github-actions/configure-builder/#max-parallelism
-
https://docs.docker.net.cn/engine/reference/builder/#buildkit-built-in-build-args
-
通过http将tunnel tty连接到docker构建
-
docker build
remote
驱动程序 https://docs.docker.net.cn/build/drivers/remote -
rootless
k8s
驱动程序 https://docs.docker.net.cn/build/drivers/kubernetes/#rootless-mode -
调整许多选项 https://docs.docker.net.cn/build/drivers/docker-container/
-
https://docs.docker.net.cn/build/attestations/sbom/
- https://github.com/moby/buildkit/blob/647a997b389757068760410053873745acabfc80/docs/attestations/sbom.md?plain=1#L48
BUILDKIT_SBOM_SCAN_CONTEXT和BUILDKIT_SBOM_SCAN_STAGE
-
-o=.
:open $HOME/.local/share/docker/overlay2/066f6../work/work: permission denied
#2219 -
cargo限制crate的目标
-
二进制文件的目标配置 #9208 https://github.com/rust-lang/cargo/issues/9208
-
不安全字段 #3458 https://github.com/rust-lang/rfcs/pull/3458
-
当大二进制文件被包含到捆绑包中时发出警告 #9058 https://github.com/rust-lang/cargo/issues/9058
-
密封构建模式 #9506 https://github.com/rust-lang/cargo/issues/9506
-
考虑将src缓存设置为只读。#9455 https://github.com/rust-lang/cargo/issues/9455
-
功能请求静态断言 #2790 https://github.com/rust-lang/rfcs/issues/2790
-
由于大型依赖树,供应链攻击风险更大? https://www.reddit.com/r/rust/comments/102yz60/greater_supply_chain_attack_risk_due_to_large/
-
https://doc.rust-lang.net.cn/rustc/command-line-arguments.html#option-emit
-
[构建]rustflags = ["--remap-path-prefix"
-
/r/Rust scare Serde已经开始提供预编译的二进制文件,并且无法选择退出
依赖关系
~8–20MB
~285K SLoC