implement docker build

This commit is contained in:
beckerinj
2022-11-13 23:19:41 -05:00
parent 475f6774bf
commit a7abca2038
12 changed files with 197 additions and 99 deletions

View File

@@ -5,8 +5,8 @@ use axum::{
Extension, Json, Router,
};
use helpers::{
docker::{self, parse_container_name, DockerClient, DockerExtension},
handle_anyhow_error,
docker::{self, DockerClient, DockerExtension},
handle_anyhow_error, to_monitor_name,
};
use serde::Deserialize;
use types::Deployment;
@@ -30,20 +30,20 @@ pub fn router() -> Router {
.route(
"/start",
post(|Json(container): Json<Container>| async move {
Json(docker::start_container(&parse_container_name(&container.name)).await)
Json(docker::start_container(&to_monitor_name(&container.name)).await)
}),
)
.route(
"/stop",
post(|Json(container): Json<Container>| async move {
Json(docker::stop_container(&parse_container_name(&container.name)).await)
Json(docker::stop_container(&to_monitor_name(&container.name)).await)
}),
)
.route(
"/remove",
post(|Json(container): Json<Container>| async move {
Json(
docker::stop_and_remove_container(&parse_container_name(&container.name)).await,
docker::stop_and_remove_container(&to_monitor_name(&container.name)).await,
)
}),
)