feat: docker_compose::start can be called with optional containers
Allow for starting just some of the containers. This will be needed for implementing postgres::import where we'll need to stop all containers and then only start postgres container.
This commit is contained in:
parent
286e16e7ce
commit
7b64d6192a
|
@ -25,7 +25,7 @@ fn main() -> Result<()> {
|
|||
cli::DockerCompose::Down => scripts::docker_compose::down(),
|
||||
cli::DockerCompose::Rebuild => scripts::docker_compose::rebuild(),
|
||||
cli::DockerCompose::Restart => scripts::docker_compose::restart(),
|
||||
cli::DockerCompose::Start => scripts::docker_compose::start(),
|
||||
cli::DockerCompose::Start => scripts::docker_compose::start(None),
|
||||
cli::DockerCompose::Stop => scripts::docker_compose::stop(),
|
||||
cli::DockerCompose::Up => scripts::docker_compose::up(),
|
||||
},
|
||||
|
|
|
@ -10,7 +10,14 @@ pub fn down() -> Result<()> {
|
|||
DockerCommand::docker_compose().args("down").spawn_wait()
|
||||
}
|
||||
|
||||
pub fn start() -> Result<()> {
|
||||
/// Start containers via `docker compose start`. Optionally pass containers to be started.
|
||||
/// ```
|
||||
/// start(None);
|
||||
/// ```
|
||||
/// is roughly the same as
|
||||
/// `docker compose --env-file ./.env -f docker/local/docker-compose.yaml up start`
|
||||
pub fn start(containers: Option<&str>) -> Result<()> {
|
||||
let args = format!("start {}", containers.unwrap_or(""));
|
||||
DockerCommand::docker_compose().args("start").spawn_wait()
|
||||
}
|
||||
|
||||
|
@ -26,10 +33,10 @@ pub fn up() -> Result<()> {
|
|||
pub fn rebuild() -> Result<()> {
|
||||
stop()?;
|
||||
build()?;
|
||||
start()
|
||||
start(None)
|
||||
}
|
||||
|
||||
pub fn restart() -> Result<()> {
|
||||
stop()?;
|
||||
start()
|
||||
start(None)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue