Fix: Use docker compose instead of docker-compose, if available.

This commit is contained in:
Bojan Čekrlić 2024-09-02 20:55:19 +02:00
parent 11cc00c942
commit 33a5edce05
3 changed files with 21 additions and 4 deletions

View file

@ -11,6 +11,11 @@ if command -v gfind > /dev/null 2>&1; then
FIND="$(which gfind)" FIND="$(which gfind)"
fi fi
DOCKER_COMPOSE="docker-compose"
if docker --help | grep -q -F 'compose*'; then
DOCKER_COMPOSE="docker compose"
fi
run_test() { run_test() {
local exit_code local exit_code
echo echo
@ -20,10 +25,10 @@ run_test() {
( (
cd "$1" cd "$1"
set +e set +e
docker-compose up --build --abort-on-container-exit --exit-code-from tests $DOCKER_COMPOSE up --build --abort-on-container-exit --exit-code-from tests
exit_code="$?" exit_code="$?"
docker-compose down -v $DOCKER_COMPOSE down -v
if [[ "$exit_code" != 0 ]]; then if [[ "$exit_code" != 0 ]]; then
exit "$exit_code" exit "$exit_code"
fi fi

View file

@ -1,3 +1,9 @@
#!/bin/sh #!/bin/sh
cd $(dirname $0) cd $(dirname $0)
docker-compose up
DOCKER_COMPOSE="docker-compose"
if docker --help | grep -q -F 'compose*'; then
DOCKER_COMPOSE="docker compose"
fi
$DOCKER_COMPOSE up

View file

@ -1,3 +1,9 @@
#!/bin/sh #!/bin/sh
cd unit-tests cd unit-tests
docker-compose up --build --abort-on-container-exit --exit-code-from tests
DOCKER_COMPOSE="docker-compose"
if docker --help | grep -q -F 'compose*'; then
DOCKER_COMPOSE="docker compose"
fi
$DOCKER_COMPOSE up --build --abort-on-container-exit --exit-code-from tests