1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-18 15:06:03 +00:00

Add Cargo.toml-based configuration for base image

- Add support for [package.metadata.krust] in Cargo.toml
- Change default base image to cgr.dev/chainguard/static:latest
- Add ProjectConfig struct to load project-specific settings
- Update documentation and example to show configuration usage
- Fix integration tests to explicitly pass directory argument
- This is the idiomatic way for Rust build tools to be configured
This commit is contained in:
Jason Hall 2025-06-07 22:14:21 -04:00
parent 5d254c7eca
commit 11083dc527
Failed to extract signature
6 changed files with 74 additions and 7 deletions

View file

@ -38,6 +38,14 @@ async fn main() -> Result<()> {
let config = Config::load()?;
let project_path = path.unwrap_or_else(|| PathBuf::from("."));
// Load project-specific config from Cargo.toml
let project_config = Config::load_project_config(&project_path)?;
// Determine base image (project config takes precedence)
let base_image = project_config
.base_image
.unwrap_or(config.base_image.clone());
// Determine the image name
let image_ref = if let Some(image) = image {
// Use explicit image if provided
@ -56,8 +64,7 @@ async fn main() -> Result<()> {
let binary_path = builder.build()?;
// Build container image
let image_builder =
ImageBuilder::new(binary_path, config.base_image.clone(), platform.clone());
let image_builder = ImageBuilder::new(binary_path, base_image, platform.clone());
let (config_data, layer_data, manifest) = image_builder.build()?;