#dockerfile #container #oci #cli-tool #api-bindings #buildah

buildah-rs

Buildah CLI 工具的包装器。适用于喜欢 Rust 而不是 Bash 的人。

4 个版本 (2 个重大更改)

0.3.0 2021 年 7 月 4 日
0.2.0 2021 年 7 月 4 日
0.1.1 2021 年 7 月 3 日
0.1.0 2021 年 7 月 3 日

#14#dockerfile

Apache-2.0 协议

15KB
244 行代码(不含注释)

Buildah

Buildah CLI 工具的包装器。适用于喜欢 Rust 而不是 Bash 的人。

对于更高级的使用案例,请使用 buildah Go 库本身。

示例

cd examples
 
# Buildah Rust
cargo run --example nginx
podman run --rm -it -p 8080:80 nginx_rust

# Buildah dockerfile
buildah bud -f nginx_dockerfile -t nginx_bud .
podman run --rm -it -p 8080:80 nginx_bud

# Buildah Bash
chmod u+x nginx.sh
./nginx.sh
podman run --rm -it -p 8080:80 nginx_bash

# Check that it worked:
buildah images

待办事项

[] 验证镜像名称

[] 改进错误处理,更好的日志记录,如果 buildah 没有安装则 panic

[] 预备:use buildah::prelude::*;

[] 在 crates.io 上发布,询问 buildah 的所有者是否可以使用它,否则使用 buildah-rs

[] 缺少许多命令和选项!

[] trait std::error::Error 未为 BuildahError 实现

[] 使用 chrome tracing 的示例

[] https://rust-lang.github.io/api-guidelines/checklist.html

[] https://blog.guillaume-gomez.fr/articles/2020-03-12+Guide+on+how+to+write+documentation+for+a+Rust+crate

[] 在 macos/windows 机器上运行此代码的文档 // 1) 本地,cargo build --release --package build_oci_images // 2) docker run --rm -v "$PWD":/app -w /app -e IMAGE_TAG=latest buildah/buildah buildah unshare target/release/build_oci_images // https://insujang.github.io/2020-11-09/building-container-image-inside-container-using-buildah/ // https://developers.redhat.com/blog/2019/08/14/best-practices-for-running-buildah-in-a-container#running_buildah_inside_a_container

许可协议

在 Apache License,版本 2.0 下许可。

贡献

除非您明确声明,否则根据 Apache-2.0 许可证定义的,您有意提交的任何贡献,都应按上述方式许可,而不附加任何其他条款或条件。

依赖项

~310–415KB