Adds support for using `bootc` as the preferred method for booting from a locally created image. This new method gets rid of the need to create a tarball and move it to the correct place and instead it will make use of `podman scp` which copies the image to the root `containers-storage` and then has `rpm-ostree` and `bootc` boot from that store. Closes #418 Closes #200
92 lines
2 KiB
Rust
92 lines
2 KiB
Rust
use bon::Builder;
|
|
use oci_distribution::Reference;
|
|
|
|
use crate::drivers::types::ContainerId;
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct RunOpts<'scope> {
|
|
pub image: &'scope str,
|
|
|
|
#[builder(default)]
|
|
pub args: &'scope [String],
|
|
|
|
#[builder(default)]
|
|
pub env_vars: &'scope [RunOptsEnv<'scope>],
|
|
|
|
#[builder(default)]
|
|
pub volumes: &'scope [RunOptsVolume<'scope>],
|
|
pub user: Option<&'scope str>,
|
|
|
|
#[builder(default)]
|
|
pub privileged: bool,
|
|
|
|
#[builder(default)]
|
|
pub pull: bool,
|
|
|
|
#[builder(default)]
|
|
pub remove: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct RunOptsVolume<'scope> {
|
|
pub path_or_vol_name: &'scope str,
|
|
pub container_path: &'scope str,
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! run_volumes {
|
|
($($host:expr => $container:expr),+ $(,)?) => {
|
|
{
|
|
::bon::vec![
|
|
$($crate::drivers::opts::RunOptsVolume::builder()
|
|
.path_or_vol_name($host)
|
|
.container_path($container)
|
|
.build(),)*
|
|
]
|
|
}
|
|
};
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct RunOptsEnv<'scope> {
|
|
pub key: &'scope str,
|
|
pub value: &'scope str,
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! run_envs {
|
|
($($key:expr => $value:expr),+ $(,)?) => {
|
|
{
|
|
::bon::vec![
|
|
$($crate::drivers::opts::RunOptsEnv::builder()
|
|
.key($key)
|
|
.value($value)
|
|
.build(),)*
|
|
]
|
|
}
|
|
};
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct CreateContainerOpts<'scope> {
|
|
pub image: &'scope Reference,
|
|
|
|
#[builder(default)]
|
|
pub privileged: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct RemoveContainerOpts<'scope> {
|
|
pub container_id: &'scope ContainerId,
|
|
|
|
#[builder(default)]
|
|
pub privileged: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, Builder)]
|
|
pub struct RemoveImageOpts<'scope> {
|
|
pub image: &'scope Reference,
|
|
|
|
#[builder(default)]
|
|
pub privileged: bool,
|
|
}
|