43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
use crate::configuration::parser::parse_compose_config;
|
|
use crate::container::{create_containers, remove_containers, start_containers, stop_containers};
|
|
use crate::helpers::docker::init_docker;
|
|
use crate::images::pull_images;
|
|
use crate::monitor::monitor_build_outputs;
|
|
use crate::volume::create_volumes;
|
|
|
|
mod configuration;
|
|
mod container;
|
|
mod helpers;
|
|
mod images;
|
|
mod monitor;
|
|
mod volume;
|
|
|
|
pub async fn down(compose_file: Option<String>) -> anyhow::Result<()> {
|
|
let compose = parse_compose_config(compose_file)?;
|
|
let docker = init_docker().await?;
|
|
|
|
stop_containers(&compose, &docker).await?;
|
|
remove_containers(&compose, &docker).await?;
|
|
Ok(())
|
|
}
|
|
|
|
pub async fn ps() -> anyhow::Result<()> {
|
|
// Here you would implement starting the services.
|
|
Ok(())
|
|
}
|
|
|
|
pub async fn up(compose_file: Option<String>, detach: bool) -> anyhow::Result<()> {
|
|
let compose = parse_compose_config(compose_file)?;
|
|
let docker = init_docker().await?;
|
|
|
|
pull_images(&compose, &docker).await;
|
|
create_volumes(&compose, &docker).await?;
|
|
let ids = create_containers(&compose, &docker, detach).await?;
|
|
start_containers(&docker, ids.clone()).await?;
|
|
|
|
if !detach {
|
|
monitor_build_outputs(&docker, ids).await?;
|
|
}
|
|
Ok(())
|
|
}
|