Skip to main content

hd_oci/
lib.rs

1//! # hd-oci
2//!
3//! OCI image ingestion and Dockerfile translation for hyperdocker.
4//!
5//! This crate handles interoperability with the OCI container ecosystem. It can
6//! pull OCI images from container registries, unpack their layers into the CAS,
7//! and translate Dockerfiles into `hd.toml` environment specs for a smooth
8//! migration path from Docker to hyperdocker.
9//!
10//! ## Key Types
11//!
12//! - [`ImageRef`] - Reference to an OCI image (registry/repo:tag)
13//! - [`unpack_layer`] - Unpacks a tar+gzip OCI layer into the CAS
14//! - [`UnpackedEntry`] - A single file extracted from a layer
15//! - [`translate_dockerfile`] - Converts a Dockerfile into an `hd.toml` spec
16//!
17//! ## Example
18//!
19//! ```no_run
20//! use hd_oci::{ImageRef, translate_dockerfile};
21//!
22//! // Translate Dockerfile content into an EnvSpec
23//! let content = std::fs::read_to_string("Dockerfile").unwrap();
24//! let spec = translate_dockerfile(&content).unwrap();
25//! println!("{:?}", spec);
26//!
27//! // Reference an OCI image
28//! let image = ImageRef::parse("ubuntu:22.04").unwrap();
29//! println!("pulling {}", image);
30//! ```
31
32pub mod registry;
33pub mod unpack;
34pub mod dockerfile;
35
36pub use registry::{ImageRef, RegistryError};
37pub use unpack::{unpack_layer, UnpackedEntry, UnpackError};
38pub use dockerfile::{translate_dockerfile, DockerfileError};