1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-10 15:42:10 +00:00
krust/src/manifest.rs
Jason Hall 6153452303
feat: Add multi-arch support
- Support building for multiple platforms with --platform flag
- Accept comma-separated platforms or multiple --platform flags
- Default to building for linux/amd64 and linux/arm64
- Add ARM runner (ubuntu-24.04-arm) to CI matrix
- Create manifest list for multi-arch images (TODO: push to registry)
- Update integration tests to handle multi-platform builds
- Add cross-compilation setup instructions to README
- Add .cargo/config.toml for local development

Breaking changes:
- Default behavior now builds for multiple platforms (amd64+arm64)
- Use --platform linux/amd64 to build for single platform
2025-06-07 22:28:15 -04:00

40 lines
1.1 KiB
Rust

use serde::{Deserialize, Serialize};
/// OCI Image Index (manifest list) for multi-arch support
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ImageIndex {
#[serde(rename = "schemaVersion")]
pub schema_version: i32,
#[serde(rename = "mediaType")]
pub media_type: String,
pub manifests: Vec<ManifestDescriptor>,
}
/// Descriptor for a platform-specific manifest in the index
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ManifestDescriptor {
#[serde(rename = "mediaType")]
pub media_type: String,
pub size: i64,
pub digest: String,
pub platform: Platform,
}
/// Platform information for a manifest
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Platform {
pub architecture: String,
pub os: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub variant: Option<String>,
}
impl ImageIndex {
pub fn new(manifests: Vec<ManifestDescriptor>) -> Self {
Self {
schema_version: 2,
media_type: "application/vnd.oci.image.index.v1+json".to_string(),
manifests,
}
}
}