1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: Apache-2.0
//! Embed Buildah in a Rust process.
//!
//! The engine is a Go c-archive behind a small C ABI. This crate exposes that
//! ABI as [`Builder::build`] and [`Builder::push`]. There is no Buildah daemon
//! and no `buildah` executable on `PATH`.
//!
//! On Linux, [`startup`] must be the first call in `main`, before threads are
//! created and before arguments are parsed. Buildah re-executes the process
//! for rootless user namespaces and for its own helper commands. On macOS,
//! [`startup`] returns immediately and [`Builder::open`] runs that same Linux
//! engine inside a Virtualization.framework guest. Other operating systems
//! link a stub and [`startup`] returns [`ErrorCode::Unsupported`].
//!
//! ```no_run
//! use oci_builder::{startup, BuildRequest, Builder, Config, StorageDriver};
//!
//! fn main() -> Result<(), oci_builder::Error> {
//! startup()?;
//! let builder = Builder::open(Config {
//! storage_driver: Some(StorageDriver::Vfs),
//! ..Config::default()
//! })?;
//! let info = builder.build(
//! BuildRequest::new("Dockerfile", ".").with_log(|record| {
//! eprint!("{}", record.message);
//! }),
//! )?;
//! println!("image_id={}", info.image_id);
//! builder.shutdown()?;
//! Ok(())
//! }
//! ```
pub use proto as rob_proto;
// Pull native/unshare_early.c into the link so its constructor runs.
unsafe extern "C"
static ROB_UNSHARE_KEEP: unsafe extern "C" fn = rob_unshare_keep;
pub use ;
pub use ;
pub use ;