Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
a2250edadb
commit
7363871ffb
@ -418,6 +418,7 @@ mod cargo_binstall;
|
|||||||
mod cargo_clean;
|
mod cargo_clean;
|
||||||
mod clap_sanity_test;
|
mod clap_sanity_test;
|
||||||
mod docker_cache;
|
mod docker_cache;
|
||||||
|
mod docker_cli;
|
||||||
mod mold;
|
mod mold;
|
||||||
mod sqlx;
|
mod sqlx;
|
||||||
mod ssh_agent;
|
mod ssh_agent;
|
||||||
@ -430,6 +431,7 @@ pub mod extensions {
|
|||||||
pub use super::cargo_clean::*;
|
pub use super::cargo_clean::*;
|
||||||
pub use super::clap_sanity_test::*;
|
pub use super::clap_sanity_test::*;
|
||||||
pub use super::docker_cache::*;
|
pub use super::docker_cache::*;
|
||||||
|
pub use super::docker_cli::*;
|
||||||
pub use super::mold::*;
|
pub use super::mold::*;
|
||||||
pub use super::sqlx::*;
|
pub use super::sqlx::*;
|
||||||
pub use super::ssh_agent::*;
|
pub use super::ssh_agent::*;
|
||||||
|
48
crates/cuddle-ci/src/rust_service/docker_cli.rs
Normal file
48
crates/cuddle-ci/src/rust_service/docker_cli.rs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use dagger_sdk::{Container, ImageMediaTypes};
|
||||||
|
|
||||||
|
use crate::dagger_middleware::DaggerMiddleware;
|
||||||
|
|
||||||
|
use super::RustService;
|
||||||
|
|
||||||
|
pub struct DockerCli {
|
||||||
|
client: dagger_sdk::Query,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DockerCli {
|
||||||
|
pub fn new(client: dagger_sdk::Query) -> Self {
|
||||||
|
Self { client }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl DaggerMiddleware for DockerCli {
|
||||||
|
async fn handle(&self, container: Container) -> eyre::Result<Container> {
|
||||||
|
let docker = self.client.container().from("docker:cli");
|
||||||
|
|
||||||
|
Ok(container
|
||||||
|
.with_file(
|
||||||
|
"/usr/local/bin/docker",
|
||||||
|
docker.file("/usr/local/bin/docker"),
|
||||||
|
)
|
||||||
|
.with_directory("/certs", docker.directory("/certs")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait DockerCliExt {
|
||||||
|
fn with_docker_cli(&mut self) -> &mut Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DockerCliExt for RustService {
|
||||||
|
fn with_docker_cli(&mut self) -> &mut Self {
|
||||||
|
self.with_stage(super::RustServiceStage::BeforePackage(Arc::new(
|
||||||
|
DockerCli::new(self.client.clone()),
|
||||||
|
)));
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user