1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-13 08:57:22 +00:00

Initial commit: krust - container image build tool for Rust

krust builds container images for Rust applications without Docker:
- Builds static binaries using musl libc
- Creates minimal OCI container images
- Pushes to any OCI-compliant registry
- Outputs digest to stdout for composability

Inspired by ko.build for Go applications.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-06-07 20:46:08 -04:00
commit 5e89023925
Failed to extract signature
23 changed files with 1611 additions and 0 deletions

53
src/cli/mod.rs Normal file
View file

@ -0,0 +1,53 @@
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "krust")]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
/// Enable verbose logging
#[arg(short, long, global = true)]
pub verbose: bool,
}
#[derive(Subcommand)]
pub enum Commands {
/// Build a container image from a Rust application
Build {
/// Path to the Rust project directory
#[arg(value_name = "DIRECTORY")]
path: Option<PathBuf>,
/// Target image reference (overrides KRUST_REPO)
#[arg(short, long, env = "KRUST_IMAGE")]
image: Option<String>,
/// Target platform (e.g., linux/amd64, linux/arm64)
#[arg(long, default_value = "linux/amd64")]
platform: String,
/// Skip pushing the image to the registry after building
#[arg(long)]
no_push: bool,
/// Repository prefix (e.g., ghcr.io/username)
#[arg(long, env = "KRUST_REPO")]
repo: Option<String>,
/// Additional cargo build arguments
#[arg(last = true)]
cargo_args: Vec<String>,
},
/// Push a built image to a container registry
Push {
/// Image reference to push
image: String,
},
/// Show version information
Version,
}