kjuulh
67803d315c
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
54 lines
1.2 KiB
Rust
54 lines
1.2 KiB
Rust
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", "update"])
|
|
.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(),
|
|
)))
|
|
.with_stage(super::RustServiceStage::BeforePackage(Arc::new(
|
|
AptCaCertificates::new(),
|
|
)))
|
|
}
|
|
}
|