Skip to content

Commit

Permalink
Fix: Use docker compose instead of docker-compose, if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Sep 2, 2024
1 parent 11cc00c commit 33a5edc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 7 additions & 2 deletions integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ if command -v gfind > /dev/null 2>&1; then
FIND="$(which gfind)"
fi

DOCKER_COMPOSE="docker-compose"
if docker --help | grep -q -F 'compose*'; then
DOCKER_COMPOSE="docker compose"
fi

run_test() {
local exit_code
echo
Expand All @@ -20,10 +25,10 @@ run_test() {
(
cd "$1"
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="$?"

docker-compose down -v
$DOCKER_COMPOSE down -v
if [[ "$exit_code" != 0 ]]; then
exit "$exit_code"
fi
Expand Down
8 changes: 7 additions & 1 deletion sample/docker-compose/start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/bin/sh
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
8 changes: 7 additions & 1 deletion unit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/bin/sh
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

0 comments on commit 33a5edc

Please sign in to comment.