2023-11-28 00:49:28 +01:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use dagger_sdk::Container;
|
|
|
|
|
2023-12-28 14:17:31 +01:00
|
|
|
use crate::{dagger_middleware::DaggerMiddleware, leptos_service::LeptosService};
|
2023-11-28 00:49:28 +01:00
|
|
|
|
|
|
|
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
|
2023-11-28 01:02:04 +01:00
|
|
|
.with_exec(vec!["apt", "update"])
|
2023-11-28 00:49:28 +01:00
|
|
|
.with_exec(vec![
|
|
|
|
"apt",
|
|
|
|
"install",
|
|
|
|
"-y",
|
|
|
|
"ca-certificates",
|
|
|
|
"build-essential",
|
|
|
|
"curl",
|
|
|
|
"libssl-dev",
|
|
|
|
])
|
|
|
|
.with_exec(vec!["update-ca-certificates"]);
|
|
|
|
|
|
|
|
Ok(c)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait AptCaCertificatesExt {
|
2023-11-28 00:51:29 +01:00
|
|
|
fn with_apt_ca_certificates(&mut self) -> &mut Self {
|
2023-11-28 00:49:28 +01:00
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AptCaCertificatesExt for RustService {
|
2023-11-28 00:51:29 +01:00
|
|
|
fn with_apt_ca_certificates(&mut self) -> &mut Self {
|
2023-11-28 00:49:28 +01:00
|
|
|
self.with_stage(super::RustServiceStage::BeforeDeps(Arc::new(
|
|
|
|
AptCaCertificates::new(),
|
|
|
|
)))
|
2023-11-28 01:02:04 +01:00
|
|
|
.with_stage(super::RustServiceStage::BeforePackage(Arc::new(
|
|
|
|
AptCaCertificates::new(),
|
|
|
|
)))
|
2023-11-28 00:49:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-28 14:17:31 +01:00
|
|
|
|
|
|
|
impl AptCaCertificatesExt for LeptosService {
|
|
|
|
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(),
|
|
|
|
)))
|
|
|
|
}
|
|
|
|
}
|