buildxargs is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the command-line executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install buildxargs
It will make the buildxargs command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall buildxargs uninstalls.
Adding buildxargs library as a dependency
Run this command in a terminal, in your project's directory:
cargo add buildxargs
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
buildxargs = "1.4.0"
The buildxargs library will be automatically available globally.
Read the buildxargs library documentation .
Back to the crate overview .
Readme
buildxargs ~ xargs for BuildKit with docker buildx bake
An efficient way of running multiple concurrent docker build jobs on the BuildKit toolkit.
# export DOCKER_HOST=ssh://...
❯ buildxargs <<EOF
docker build --build-arg ARGs='--format mp4 -- https://www.youtube.com/watch?v=Hj7LwZqTflc' --output=~/Videos https://github.com/fenollp/dockerhost-tools.git
docker build -o=. --platform=local --build-arg PREBUILT=1 https://github.com/FuzzyMonkeyCo/monkey.git
docker build --platform=local -o . https://github.com/docker/buildx.git
EOF
This is equivalent to executing the following
❯ export DOCKER_BUILDKIT=1
❯ xargs - P0 - o - I{ } { } << EOF
docker build ...
docker build ...
...
docker build ...
EOF
Usage
...docker buildx bake' s --help...
--
xargs for BuildKit with docker buildx bake
Usage: buildxargs [BAKE OPTIONS] [OPTIONS]
Options:
--retry <RETRY> Retry each failed build at most this many times [default: 3]
--help Print help
-V, --version Print version
Try:
buildxargs <<EOF
docker build --platform=local -o . https://github.com/docker/buildx.git
docker build --tag my-image:latest https://github.com/bojand/ghz.git
EOF
Installing
cargo install -- locked -- git https://github.com/fenollp/buildxargs
# also: install Docker ≥ 18.09
See also
My blog post about this .
Related:
TODO
Spawn tasks in background, attach to display logs, cancel.
OPTIONS:
--attach ssh HOST - t /usr/bin/htop + replay daemon logs
--background Spawns calls using bg daemon and logs text back for log replain