dagger-components/crates/cuddle-ci/src/rust_service/apt_ca_certificates.rs

50 lines
1.1 KiB
Rust
Raw Normal View History

use std::sync::Arc;
use async_trait::async_trait;
use dagger_sdk::Container;
use crate::dagger_middleware::DaggerMiddleware;
use super::RustService;
pub struct AptCaCertificates {}
impl AptCaCertificates {
pub fn new() -> Self {
Self {}
}
}
#[async_trait]
impl DaggerMiddleware for AptCaCertificates {
async fn handle(&self, container: Container) -> eyre::Result<Container> {
let c = container
.with_exec(vec![
"apt",
"install",
"-y",
"ca-certificates",
"build-essential",
"curl",
"libssl-dev",
])
.with_exec(vec!["update-ca-certificates"]);
Ok(c)
}
}
pub trait AptCaCertificatesExt {
fn with_apt_ca_certificates(&mut self) -> &mut Self {
self
}
}
impl AptCaCertificatesExt for RustService {
fn with_apt_ca_certificates(&mut self) -> &mut Self {
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
AptCaCertificates::new(),
)))
}
}