feat: with ca certificates
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-11-28 00:49:28 +01:00
parent a5d08f4a0d
commit 62f66452c2
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 51 additions and 0 deletions

View File

@ -402,6 +402,7 @@ pub mod architecture {
} }
mod apt; mod apt;
mod apt_ca_certificates;
mod cargo_binstall; mod cargo_binstall;
mod cargo_clean; mod cargo_clean;
mod clap_sanity_test; mod clap_sanity_test;
@ -410,6 +411,7 @@ mod sqlx;
pub mod extensions { pub mod extensions {
pub use super::apt::*; pub use super::apt::*;
pub use super::apt_ca_certificates::*;
pub use super::cargo_binstall::*; pub use super::cargo_binstall::*;
pub use super::cargo_clean::*; pub use super::cargo_clean::*;
pub use super::clap_sanity_test::*; pub use super::clap_sanity_test::*;

View File

@ -0,0 +1,49 @@
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, deps: &[&str]) -> &mut Self {
self
}
}
impl AptCaCertificatesExt for RustService {
fn with_apt_ca_certificates(&mut self, deps: &[&str]) -> &mut Self {
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
AptCaCertificates::new(),
)))
}
}