From 111e781f6f6a16fda79bc5778a05e90c363c88ae Mon Sep 17 00:00:00 2001 From: Martin Othamar Date: Thu, 16 May 2024 18:03:30 +0200 Subject: [PATCH] Prefer docker-compose over podman-compose due to --profile support being relatively recent in podman --- scripts/run.ps1 | 17 +++++++++++++++++ scripts/run.sh | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/scripts/run.ps1 b/scripts/run.ps1 index 59614a84..517da21a 100755 --- a/scripts/run.ps1 +++ b/scripts/run.ps1 @@ -9,6 +9,14 @@ if ($args[0] -eq "stop") Write-host "Stopping using docker" docker compose --profile "*" down -v } + elseif (Get-Command "docker-compose" -errorAction SilentlyContinue) + { + # If the user is not using docker, there should be podman installed + # If additionally docker-compose is installed, we use that since it has had '--profile' support for a long time, + # whereas podman-compose has only recently added support, and not many users have the latest versions + Write-host "Stopping using docker-compose" + docker-compose --file podman-compose.yml --profile "*" down -v + } elseif (Get-Command "podman" -errorAction SilentlyContinue) { Write-host "Stopping using podman" @@ -29,6 +37,15 @@ else docker compose --profile "*" down -v docker compose --profile "*" up -d --build } + elseif (Get-Command "docker-compose" -errorAction SilentlyContinue) + { + # If the user is not using docker, there should be podman installed + # If additionally docker-compose is installed, we use that since it has had '--profile' support for a long time, + # whereas podman-compose has only recently added support, and not many users have the latest versions + Write-host "Running using docker-compose" + docker-compose --file podman-compose.yml --profile "*" down -v + docker-compose --file podman-compose.yml --profile "*" up -d --build + } elseif (Get-Command "podman" -errorAction SilentlyContinue) { Write-host "Running using podman" diff --git a/scripts/run.sh b/scripts/run.sh index 155e0a77..e34c9119 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -7,6 +7,12 @@ if [ $1 = "stop" ]; then if [ -x "$(command -v docker)" ]; then echo "Stopping using docker" docker compose --profile "*" down -v + elif [ -x "$(command -v docker-compose)" ]; then + # If the user is not using docker, there should be podman installed + # If additionally docker-compose is installed, we use that since it has had '--profile' support for a long time, + # whereas podman-compose has only recently added support, and not many users have the latest versions + echo "Stopping using docker-compose" + docker-compose --file podman-compose.yml --profile "*" down -v elif [ -x "$(command -v podman)" ]; then echo "Stopping using podman" podman compose --file podman-compose.yml --profile "*" down -v @@ -20,6 +26,13 @@ else echo "Running using docker" docker compose --profile "*" down -v docker compose --profile "*" up -d --build + elif [ -x "$(command -v docker-compose)" ]; then + # If the user is not using docker, there should be podman installed + # If additionally docker-compose is installed, we use that since it has had '--profile' support for a long time, + # whereas podman-compose has only recently added support, and not many users have the latest versions + echo "Running using docker-compose" + docker-compose --file podman-compose.yml --profile "*" down -v + docker-compose --file podman-compose.yml --profile "*" up -d --build elif [ -x "$(command -v podman)" ]; then echo "Running using podman" podman compose --file podman-compose.yml --profile "*" down -v