### Build and Push an OCI Image Source: https://github.com/alienplatform/dockdash/blob/main/README.md A complete example demonstrating how to create a layer, build an image, and push it to a registry. ```rust use dockdash::{Arch, Image, Layer, PushOptions, Result}; use std::path::PathBuf; #[tokio::main] async fn main() -> Result<()> { // Create a layer from a local binary let layer = Layer::builder()? .file("./target/release/my-app", "./my-app", Some(0o755))? .build() .await?; // Build the OCI image let (image, _) = Image::builder() .from("ubuntu:latest") .platform("linux", &Arch::ARM64) .layer(layer) .entrypoint(vec!["/my-app".to_string()]) .output_to(PathBuf::from("image.oci.tar")) .build() .await?; // Push to a registry image.push("my-registry.com/my-app:latest", &PushOptions::default()).await?; Ok(()) } ``` -------------------------------- ### Run project tests Source: https://github.com/alienplatform/dockdash/blob/main/README.md Commands to execute unit and integration tests for the project. ```bash # Unit tests cargo test # Integration tests (requires Docker for Bollard-based tests) cargo test --features test-utils ``` -------------------------------- ### Configure Dependencies Source: https://github.com/alienplatform/dockdash/blob/main/README.md Add the necessary dependencies to your Cargo.toml file. ```toml [dependencies] dockdash = "0.2" tokio = { version = "1", features = ["full"] } ``` -------------------------------- ### Create Layers Source: https://github.com/alienplatform/dockdash/blob/main/README.md Construct layers from local files or raw byte data. ```rust // From a file on disk let layer = Layer::builder()? .file("./my-binary", "./app/my-binary", Some(0o755))? .build() .await?; // From raw bytes let layer = Layer::builder()? .data("./app/config.toml", config_bytes, None)? .build() .await?; // Multiple files in one layer let layer = Layer::builder()? .file("./binary", "./app/binary", Some(0o755))? .file("./config.toml", "./app/config.toml", None)? .data("./app/version.txt", b"1.0.0", None)? .build() .await?; ``` -------------------------------- ### Configure Registry Authentication Source: https://github.com/alienplatform/dockdash/blob/main/README.md Set up authentication options for pushing images to registries. ```rust use dockdash::{RegistryAuth, PushOptions, ClientProtocol}; // Anonymous (e.g., ttl.sh) let opts = PushOptions::default(); // Basic auth let opts = PushOptions { auth: RegistryAuth::Basic("user".into(), "pass".into()), ..Default::default() }; // HTTP (for local registries) let opts = PushOptions { protocol: ClientProtocol::Http, ..Default::default() }; ``` -------------------------------- ### Implement Blob Caching Source: https://github.com/alienplatform/dockdash/blob/main/README.md Configure content-addressable caching to optimize build times. ```rust use dockdash::BlobCache; // Default location: ~/.dockdash/cache/blobs let cache = BlobCache::new()?; // Or use a custom cache directory (path is used as-is) let cache = BlobCache::with_path("/my/custom/cache".into())?; let layer = Layer::builder()? .blob_cache(cache.clone()) .file("./my-binary", "./app/my-binary", Some(0o755))? .build() .await?; let (image, _) = Image::builder() .from("alpine:latest") .blob_cache(cache) .layer(layer) .build() .await?; ``` -------------------------------- ### Compose Images Source: https://github.com/alienplatform/dockdash/blob/main/README.md Assemble an image using a base image and multiple custom layers. ```rust let (image, diagnostics) = Image::builder() .from("alpine:3.19") .platform("linux", &Arch::Amd64) .layer(app_layer) .layer(config_layer) .entrypoint(vec!["/app/server".to_string()]) .working_dir("/app") .build() .await?; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.