Skip to content

Commit 33a5edc

Browse files
committed
Fix: Use docker compose instead of docker-compose, if available.
1 parent 11cc00c commit 33a5edc

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

integration-tests.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ if command -v gfind > /dev/null 2>&1; then
1111
FIND="$(which gfind)"
1212
fi
1313

14+
DOCKER_COMPOSE="docker-compose"
15+
if docker --help | grep -q -F 'compose*'; then
16+
DOCKER_COMPOSE="docker compose"
17+
fi
18+
1419
run_test() {
1520
local exit_code
1621
echo
@@ -20,10 +25,10 @@ run_test() {
2025
(
2126
cd "$1"
2227
set +e
23-
docker-compose up --build --abort-on-container-exit --exit-code-from tests
28+
$DOCKER_COMPOSE up --build --abort-on-container-exit --exit-code-from tests
2429
exit_code="$?"
2530

26-
docker-compose down -v
31+
$DOCKER_COMPOSE down -v
2732
if [[ "$exit_code" != 0 ]]; then
2833
exit "$exit_code"
2934
fi

sample/docker-compose/start.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#!/bin/sh
22
cd $(dirname $0)
3-
docker-compose up
3+
4+
DOCKER_COMPOSE="docker-compose"
5+
if docker --help | grep -q -F 'compose*'; then
6+
DOCKER_COMPOSE="docker compose"
7+
fi
8+
9+
$DOCKER_COMPOSE up

unit-tests.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#!/bin/sh
22
cd unit-tests
3-
docker-compose up --build --abort-on-container-exit --exit-code-from tests
3+
4+
DOCKER_COMPOSE="docker-compose"
5+
if docker --help | grep -q -F 'compose*'; then
6+
DOCKER_COMPOSE="docker compose"
7+
fi
8+
9+
$DOCKER_COMPOSE up --build --abort-on-container-exit --exit-code-from tests

0 commit comments

Comments
 (0)